> c_message.GetWindowText(s);
I suspect the string is Unicode.
On Jun 6, 5:54 am, Gary <[email protected]> wrote:
> Hello
> I use of RSA sign and verify code in my program such below:
>
> //sign a message
> c_message.GetWindowText(s);
> // Output: Signed Message M
> byte signature[256];
>
> AutoSeededRandomPool rng;
> StringSource privArray(privkey1,privkeysize,true,NULL);
> RSASSA_PKCS1v15_SHA_Signer priv(privArray);
>
> // Sign Away...
> StringSource((const char *)s.GetString(), true,
> new SignerFilter( rng, priv,
> new ArraySink(signature,256)
> )// SignerFilter
> ); // StringSource
>
> //Verify signature
> string message = "Yoda said, Do or Do Not. There is not try.";
> //Verify signature
> // Load Public Key
> StringSource pubArray(pubkey1,pubsize, true,NULL);
> StringSource SignatureArray( signature,priv.SignatureLength(),
> true,NULL);
> // Verifier Object
> RSASSA_PKCS1v15_SHA_Verifier pub(pubArray);
> // Sanity Check
> if (SignatureArray.MaxRetrievable() != pub.SignatureLength())
> m_List.AddString(L"Signature Array Size Problem");
>
> SecByteBlock Signature( pub.SignatureLength() );
> SignatureArray.Get( Signature, Signature.size());
> // Prepare Verifier
> VerifierFilter *verifierFilter =new VerifierFilter(pub);
> verifierFilter->Put(Signature, pub.SignatureLength());
> // Invoke Verifier
> StringSource(message/*(const char *)s.GetString()*/, true,
> verifierFilter );
> // Paydirt
> if( false == verifierFilter->GetLastResult() )
> m_List.AddString(L"Signature Verification Failed");
> m_List.AddString(L"Signature Verified");
>
> [SNIP]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the "Crypto++ Users"
Google Group.
To unsubscribe, send an email to [email protected].
More information about Crypto++ and this group is available at
http://www.cryptopp.com.
-~----------~----~----~----~------~----~------~--~---