Hi,

I'm also a newbie to crypto++ and c++. I saw ur previous post and
actually I'm also having some problems with RSA encryption with
Base64. My post is sent to moderator and hasn't shown up yet. :P
I don't know it will help you or not but at least you can try.

Instead of loading into RSA::PirvateKey, pls try
RSAES_OAEP_SHA_Decryptor since you're trying to decrypt.

----
FileSource file_pk("key.cert", true, new Base64Decoder);
RSAES_OAEP_SHA_Decryptor de(file_pk);
----

And then decrypt it

----
AutoSeededRandomPool rng;
String decryptedText;
StringSource( your_cipher_text, true,
    new PK_DecryptorFilter( rng, de,
        new StringSink( decryptedText )
    )
 );
----

Hope it helps.

Regards,
Aung

On Dec 3, 1:01 am, adfm <[email protected]> wrote:
> OK,
>
> I've been going through cryptopp trying to decrypt a a file and I am
> having some trouble right from the start. How fun is this? ;)
>
> I was given a certificate in a pfx file and I extracted the
> certificate from it I then proceeded to decrypt the text.
>
> I loaded the certificate's private key like this:
>
>         string decoded;
>         CryptoPP::RSA::PrivateKey private_key;
>         FileSource file_pk("key.cert", true, new Base64Decoder);
>         private_key.Load( file_pk );
>
> this fails miserably with a "BER decode error".
>
> Well, I got to openssl and did a openssl asn1parse of the certificate
> and it is encoded in PEM (at least it ouputs a ton a things that make
> sense).
>
> The certificate is in this form
> -----BEGIN CERTIFICATE-----
> MIICuzCCAiSg(...)BBQUAMGkxCzAJBgNV
> (...)
> /9kfj2B6h78n(...)3xJQMApR5yXW0IkEg==
> -----END CERTIFICATE-----
>
> So my question is how do I use this certificate in PEM?
>
> Just some dumb doubts:
> - Is the certificate the private key?
> - In this format do I need to decode in from base64 or will the
> decoder do it implicitly?
> - Why is this list so quiet? I read someone complaining that posting
> here is like discovering an abandoned civilization....
>
> As you might have guesses I've posted a bit in the couple of days to
> no avail. Some of this question concerns my previous post, so...
>
> 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