Hi,

I generated a key pair on Crypto++ & encrypted a text message (public
key) and
now I'm trying to decrypt it using the private key (converted into
PEM) on OpenSSL (PHP).

at that I got the following error from OpenSSL:

error:0406506C:rsa routines:RSA_EAY_PRIVATE_DECRYPT:data greater than
mod len

Encrypt and decrypt via Crypto++ is working perfectly
Encrypt and decrypt via OpenSSL with the same keys converted into PEM
format is also working.

Why are Crypto++ and OpenSSL not interoperable and whats the
distinction between the two?

The message is encrypted that way:

string RSAEncString(const char *publickey,  const char *message)
{
           FileSource pubKey(publickey, true, new HexDecoder);
           RSAES_OAEP_SHA_Encryptor pubK(pubKey);

           string result;
           StringSource(message, true, new PK_EncryptorFilter(GlobalRNG(),
pubK, new Base64Encoder(new StringSink(result))));
           return result;
}

What can I do to make them interoperable? Regards JKolitz.

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