tags:

views:

168

answers:

0

Hello all

I am posting here because cryptopp list is... well in a coma! Nobody seems to answer anything there.

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.pem", 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 PEM certificate in crypto++?

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?

Cheers