Hello
I use of RSA sign and verify code in my program such below:
//sign a message
string message = "Yoda said, Do or Do Not. There is not try.";
byte signature[256];
AutoSeededRandomPool rng;
StringSource privArray(privkey1,privkeysize,true,NULL);
RSASSA_PKCS1v15_SHA_Signer priv(privArray);
// Sign Away...
StringSource(message, true,
new SignerFilter( rng, priv,
new ArraySink(signature,256)
)// SignerFilter
); // StringSource
//Verify signature
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, true, new Redirector(*verifierFilter));
// Paydirt
if( false == verifierFilter->GetLastResult() )
m_List.AddString(L"Signature Verification Failed");
else
m_List.AddString(L"Signature Verified");
I need to zero the public key in part of my program as following:
for(int i=0;i<pubsize;i++)
pubkey1[i]=0;
but then I get a diagnostic as below:
Unhandled exception at 0x7c812aeb in program.exe: Microsoft C++
exception: CryptoPP::BERDecodeErr at memory location 0x0012dc9c..
in this line:
RSASSA_PKCS1v15_SHA_Verifier pub(pubArray);
Related to " inline void BERDecodeError() {throw BERDecodeErr();" line
of " asn.h" file!
How could I suppress this problem?
And a general problem:
When I use CryptoPP library compiled with Multi-threaded Debug DLL (/
MDd) switch in my project, I get 4 warnings as below:
Crypto++
1>C:\ config.h(434) : warning RC4011: identifier truncated to
'CRYPTOPP_MANUALLY_INSTANTIATE_T'
1>C:\ config.h(448) : warning RC4011: identifier truncated to
'CRYPTOPP_MANUALLY_INSTANTIATE_T'
1>C:\ secblock.h(488) : warning RC4011: identifier truncated to
'_STLP_DONT_SUPPORT_REBIND_MEMBE'
1>C:\ osrng.h(143) : warning RC4011: identifier truncated to
'CRYPTOPP_ENABLE_COMPLIANCE_WITH'
What is the reason of these warnings?
Thanks in Advance.
Gary
--~--~---------~--~----~------------~-------~--~----~
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.
-~----------~----~----~----~------~----~------~--~---