Hi Bob,
http://www.cryptopp.com/wiki/RSA
Jeff
On 9/11/07, Bob Doppens <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
> It seems that the RsaSignFile method (taken from test.cpp) returns
> different values depending on the compilation mode (release or debug).
> While the method works ok in debug it doesn't seem to work in release
> (means returns a wrong value).
>
> Here are the 2 slightly modified methods (for signing and verifying):
>
> static std::string sign(const std::string& message, const std::string&
> priv_key)
> {
> std::string sig;
> CryptoPP::StringSource source(priv_key, true, new
> CryptoPP::HexDecoder());
> CryptoPP::RSASS<CryptoPP::PKCS1v15, CryptoPP::SHA>::Signer
> signer(source);
> CryptoPP::StringSource(message, true, new
> CryptoPP::SignerFilter(CryptoPP::AutoSeededRandomPool(), signer,
> new CryptoPP::HexEncoder(new
> CryptoPP::StringSink(sig))));
>
> return sig;
> }
>
> static bool verify(const std::string& message, const std::string&
> pub_key , const std::string& sig)
> {
> CryptoPP::StringSource pub_source(pub_key, true, new
> CryptoPP::HexDecoder());
> CryptoPP::RSASS<CryptoPP::PKCS1v15, CryptoPP::SHA>::Verifier
> verifier(pub_source);
>
> CryptoPP::StringSource sig_source(sig, true, new
> CryptoPP::HexDecoder());
> if (sig_source.MaxRetrievable() != verifier.SignatureLength())
> return false;
>
> CryptoPP::SecByteBlock signature(verifier.SignatureLength());
> sig_source.Get(signature, signature.size());
>
> CryptoPP::VerifierFilter *filter = new
> CryptoPP::VerifierFilter(verifier);
> filter->Put(signature, verifier.SignatureLength());
> CryptoPP::StringSource(message, true, filter);
>
> return filter->GetLastResult();
> }
>
> Any help would be appreciated
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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.
-~----------~----~----~----~------~----~------~--~---