Dave,
Thank you. I modified my code. I have one additional question. When my
function returns, why is cryptopp appending a new line (/n) to the end of
the signed string? My code is now as follows:
void Sign(const std::string& plainText, const std::string&
privateKeyString, std::string& signedText)
{
CryptoPP::SHA256 hash;
byte digest[CryptoPP::SHA256::DIGESTSIZE];
hash.CalculateDigest(digest, (const byte*)plainText.c_str(),
plainText.length());
CryptoPP::Base64Encoder encoder;
byte buffer[2 * CryptoPP::SHA256::DIGESTSIZE]; // Output size of the
buffer
CryptoPP::StringSource ss(plainText, true, new
CryptoPP::HashFilter(hash, new CryptoPP::Base64Encoder(new
CryptoPP::StringSink(signedText))));
}
Thank you,
Adam
On Tuesday, December 11, 2012 5:11:30 PM UTC-8, Adam Cooper wrote:
> I am getting the exception:
>
> "FilterWithBufferedInput: Nonblocking input is not implemented by this
> object."
>
> When I call the following code which I wrote using the CryptoPP API:
>
> void Sign (const std::string& plainText, const std::string&
> privateKeyString, std::string& signedText)
> {
> CryptoPP::SHA256 hash;
> byte digest[CryptoPP::SHA256::DIGESTSIZE];
> hash.CalculateDigest(digest, (const byte*)plainText.c_str(),
> plainText.length());
> CryptoPP::Base64Encoder encoder;
>
> encoder.Attach(new CryptoPP::StringSink(signedText));
> encoder.Put(digest, sizeof(digest));
> encoder.MessageEnd();
> }
>
> Please advise how to resolve this exception?
>
> Thank you,
> Adam
>
--
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.