Hello, I am trying to get RSA Encryption/Decryption working for my program.
This is what I have so far:
std::string xxz568::rsaEncrypt(const CryptoPP::Integer e, const
CryptoPP::Integer n, std::string message) {
AutoSeededRandomPool rng;
std::string holder;
RSAES_OAEP_SHA_Encryptor enc;
enc.AccessKey().Initialize(n, e);
StringSource(message, true,
new PK_EncryptorFilter(rng, enc,
new HexEncoder(
new StringSink(holder), false
)
) // PK_EncryptorFilter
); // StringSource
return holder;
}
std::string xxz568::RSADecrypt(const CryptoPP::Integer d, std::string
message) {
AutoSeededRandomPool rng;
std::string holder;
RSAES_OAEP_SHA_Decryptor dec;
dec.AccessKey().SetPrivateExponent(d);
StringSource(message, true,
new PK_DecryptorFilter(rng, dec,
new HexDecoder(
new StringSink(holder)
)
) // PK_EncryptorFilter
); // StringSource
return holder;
}
I'm trying to work with the exact parameters I have above (IE: Encrypt given
E and N, and Decrypt given D). Will this work? or is some adjustment needed
to my code?
--
View this message in context:
http://old.nabble.com/RSA-Encryption-Decryption-tp31471628p31471628.html
Sent from the Crypto++ Users mailing list archive at Nabble.com.
--
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.