On Apr 25, 11:21 am, "Robert F." <[email protected]> wrote:
> 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?
The public key is (n,e) and the private key is (n,e,d). I don't
believe your decryptor will work as shown.

Jeff

-- 
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.

Reply via email to