Some questions about C++ Builder and SecureBridge

Discussion of open issues, suggestions and bugs regarding network security and data protection solution - SecureBridge
Post Reply
akm
Posts: 13
Joined: Mon 16 Apr 2007 01:01
Contact:

Some questions about C++ Builder and SecureBridge

Post by akm » Tue 26 Jan 2010 02:51

1. Why in C++ Builder I need write

Code: Select all

	  FFingerPrint = Scconsts_SKeyNotReady;
but in your example in Delphi you write

Code: Select all

      FFingerPrint := SKeyNotReady;
2. For randomizing I need explishit create object

Code: Select all

void __fastcall TSettingsForm::RandomizeIt(void)
{
   auto_ptr RandomForm(new TRandomForm(Application));
   auto_ptr ScRandom(new TScRandom());
   if (RandomForm->ShowModal() == mrOk)
   {
     ScRandom->Randomize((void *)RandomForm->Data.c_str(), DATASIZE);
     FRandomized = true;
   }
}
because I hav'n t access to methods of TScRandom;
P.S.

Code from TRandomForm

Code: Select all

RandomForm.h
...
private:	// User declarations
	AnsiString FData;
	int FCount;
...
...
RandomFormUnit.cpp
void __fastcall TRandomForm::FormMouseMove(TObject *Sender, TShiftState Shift, int X,
          int Y)
{
  __int64 data;

  if (FCount >= DATASIZE)
	return;

  data = X ^ Y ^ PerfCounter();
  FData[FCount] = (char)data ^ 256;
  FCount++;
  data = data >> 8;
  FData[FCount] = (char)data ^ 256;
  FCount++;
  ProgressBar->StepIt();

  if (FCount >= DATASIZE)
  {
	lbInform->Caption = "The data for the random generator has been generated!";
	btClose->ModalResult = mrOk;
	btClose->Caption = "&OK";
  }
}
[/code]

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Tue 26 Jan 2010 08:40

1. This problem is connected with the specificity of C++ Builder work. The ScConsts.hpp file defines the SKeyNotReady constant as Scconsts_SKeyNotReady.

2. You can use the Random object of the TScRandom class, that is declared in the ScBridge unit, like this:

Code: Select all

  Random->Randomize((void *)RandomForm->Data.c_str(), DATASIZE); 

Post Reply