コード例 #1
0
ファイル: DSAKeys1.cpp プロジェクト: graemeg/lockbox2
void __fastcall TfrmDSAKeys::btnCreateKeysClick(TObject *Sender)
{
  Screen->Cursor = crHourGlass;
  StatusBar1->SimpleText = "Generating key pair, this may take a while";
  try
  {
    LbDSA1->PrimeTestIterations = (unsigned char) StrToIntDef(edtIterations->Text, 20);
    LbDSA1->KeySize = TLbAsymKeySize(cbxKeySize->ItemIndex);
    LbDSA1->GenerateKeyPair();
    UpdatePrivateKeyFields();
    UpdatePublicKeyFields();
  }
  __finally
  {
    Screen->Cursor = crDefault;
    StatusBar1->SimpleText = "";
  }
}
コード例 #2
0
//---------------------------------------------------------------------------
void __fastcall TForm1::btnCreateKeysClick(TObject *Sender)
{
  Screen->Cursor = crHourGlass;
  StatusBar1->SimpleText = "Generating key pair, this may take a while";
  try {
    LbRSA1->PrimeTestIterations = StrToIntDef(edtIterations->Text, 20);
    LbRSA1->KeySize = TLbAsymKeySize(cbxKeySize->ItemIndex);
    LbRSA1->GenerateKeyPair();
    edtPublicE->Text  = LbRSA1->PublicKey->ExponentAsString;
    edtPublicM->Text  = LbRSA1->PublicKey->ModulusAsString;
    edtPrivateE->Text = LbRSA1->PrivateKey->ExponentAsString;
    edtPrivateM->Text = LbRSA1->PrivateKey->ModulusAsString;
  }
  catch (...) {
  } // swallow any errors
  Screen->Cursor = crDefault;
  StatusBar1->SimpleText = "";
}