Hello all

Well, I've been going through my personal hell these days

I am having some trouble decrypting a message that was encrypted using
RSA and I'm always failing with a "RSA/OAEP-MGF1(SHA-1): invalid
ciphertext"

1. I have a private key encoded in base64 and I load it:

            RSA::PrivateKey private_key;
            StringSource file_pk(PK,true,new Base64Decoder);
            private_key.Load( file_pk );

2. I then proceed to decode the message by doing:

        RSAES_OAEP_SHA_Decryptor decryptor(private_key);

        AutoSeededRandomPool rng;

        string result;
        StringSource(ciphertext, true,
            new PK_DecryptorFilter(rng, decryptor,
                new StringSink(result)
            )
        );

Before doing this step the message has already been decoded from
base64, that's why there is no Base64Decoder filter before the
PK_DecryptorFilter.

As far as I can tell, the message should be being parsed without any
problems. ciphertext is an std::string, so no \0 at the end that could
do something unexpected.

I just though of something, and what if the private key is incorrect
but can be loaded anyway without throwing a BER decode error. What
would that throw when decrypting?

Hope that anyone can shed some light on this.

Cheers

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