void VolumeCreationProgressWizardPage::SetKeyInfo (const VolumeCreator::KeyInfo &keyInfo) { if (DisplayKeysCheckBox->IsChecked()) { ShowBytes (RandomPoolSampleStaticText, RandomNumberGenerator::PeekPool(), true); ShowBytes (HeaderKeySampleStaticText, keyInfo.HeaderKey); ShowBytes (MasterKeySampleStaticText, keyInfo.MasterKey); } }
RandomPoolEnrichmentDialog::RandomPoolEnrichmentDialog (wxWindow* parent) : RandomPoolEnrichmentDialogBase (parent) { RandomNumberGenerator::Start(); Hashes = Hash::GetAvailableAlgorithms(); foreach (shared_ptr <Hash> hash, Hashes) { if (!hash->IsDeprecated()) { HashChoice->Append (hash->GetName(), hash.get()); if (typeid (*hash) == typeid (*RandomNumberGenerator::GetHash())) HashChoice->Select (HashChoice->GetCount() - 1); } } ShowBytes (RandomPoolStaticText, RandomNumberGenerator::PeekPool().GetRange (0, 24)); MouseStaticText->Wrap (Gui->GetCharWidth (MouseStaticText) * 70); MainSizer->SetMinSize (wxSize (-1, Gui->GetCharHeight (this) * 24)); Layout(); Fit(); Center(); foreach (wxWindow *c, this->GetChildren()) c->Connect (wxEVT_MOTION, wxMouseEventHandler (RandomPoolEnrichmentDialog::OnMouseMotion), nullptr, this); }
void RandomPoolEnrichmentDialog::OnMouseMotion (wxMouseEvent& event) { event.Skip(); RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <byte *> (&event), sizeof (event))); long coord = event.GetX(); RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <byte *> (&coord), sizeof (coord))); coord = event.GetY(); RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <byte *> (&coord), sizeof (coord))); if (ShowRandomPoolCheckBox->IsChecked()) ShowBytes (RandomPoolStaticText, RandomNumberGenerator::PeekPool().GetRange (0, 24)); }
VolumeCreationProgressWizardPage::VolumeCreationProgressWizardPage (wxPanel* parent, bool displayKeyInfo) : VolumeCreationProgressWizardPageBase (parent), PreviousGaugeValue (0), ProgressBarRange (1), RealProgressBarRange (1), VolumeCreatorRunning (false) { DisplayKeysCheckBox->SetValue (displayKeyInfo); #ifdef TC_WINDOWS DisplayKeysCheckBox->SetLabel (L""); #endif #ifdef TC_MACOSX ProgressGauge->SetMinSize (wxSize (-1, 12)); // OS X apparently supports only up to 12px thick progress bars KeySamplesUpperSizer->Remove (KeySamplesUpperInnerSizer); #else ProgressGauge->SetMinSize (wxSize (-1, Gui->GetCharHeight (this) * 2)); #endif if (DisplayKeysCheckBox->IsChecked()) ShowBytes (RandomPoolSampleStaticText, RandomNumberGenerator::PeekPool(), true); else ShowAsterisks (RandomPoolSampleStaticText); class Timer : public wxTimer { public: Timer (VolumeCreationProgressWizardPage *page) : Page (page) { } void Notify() { Page->OnRandomPoolTimer(); } VolumeCreationProgressWizardPage *Page; }; RandomPoolTimer.reset (dynamic_cast <wxTimer *> (new Timer (this))); RandomPoolTimer->Start (30); AbortButton->Disable(); ProgressGauge->SetValue (0); }
void VolumeCreationProgressWizardPage::OnRandomPoolTimer () { if (!VolumeCreatorRunning && DisplayKeysCheckBox->IsChecked()) ShowBytes (RandomPoolSampleStaticText, RandomNumberGenerator::PeekPool(), true); }
void msg_test2(wchar_t const*const subject_str){ //--------------------------------------------------------------- // Declare and initialize local variables. //--------------------------------------------------------------- // pbToBeSignedAndEncrypted is the message to be // encrypted and signed. const BYTE *pbToBeSignedAndEncrypted = (const unsigned char *)"Insert the message to be signed " "here"; //--------------------------------------------------------------- // This is the length of the message to be // encrypted and signed. Note that it is one // more that the length returned by strlen() // to include the terminating null character. DWORD cbToBeSignedAndEncrypted = lstrlenA((const char *)pbToBeSignedAndEncrypted) + 1; //--------------------------------------------------------------- // Pointer to a buffer that will hold the // encrypted and signed message. BYTE *pbSignedAndEncryptedBlob; //--------------------------------------------------------------- // A double word to hold the length of the signed // and encrypted message. DWORD cbSignedAndEncryptedBlob; BYTE *pReturnMessage; //--------------------------------------------------------------- // Call the local function SignAndEncrypt. // This function returns a pointer to the // signed and encrypted BLOB and also returns // the length of that BLOB. pbSignedAndEncryptedBlob = SignAndEncrypt( subject_str, pbToBeSignedAndEncrypted, cbToBeSignedAndEncrypted, &cbSignedAndEncryptedBlob); _tprintf(TEXT("The following is the signed and encrypted ") TEXT("message.\n")); ShowBytes(pbSignedAndEncryptedBlob,cbSignedAndEncryptedBlob/4); // Open a file and write the signed and // encrypted message to the file. WriteSignedAndEncryptedBlob( cbSignedAndEncryptedBlob, pbSignedAndEncryptedBlob); //--------------------------------------------------------------- // Call the local function DecryptAndVerify. // This function decrypts and displays the // encrypted message and also verifies the // message's signature. if(pReturnMessage = DecryptAndVerify( pbSignedAndEncryptedBlob, cbSignedAndEncryptedBlob)) { _tprintf(TEXT(" The returned, verified message is ->\n%s\n"), pReturnMessage); _tprintf(TEXT(" The program executed without error.\n")); } else { _tprintf(TEXT("Verification failed.\n")); } } // End Main.