On Wed, Dec 02, 2009 at 09:01:27AM -0800, adfm 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).
PEM is not ASN.1 or DER, it's just base64
> 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?
no.
Public key is a part of an X.509 certificate
In case you can see that part,
you might be able to copy it to another file
and load it as a public key
> - In this format do I need to decode in from base64 or will the
> decoder do it implicitly?
would "openssl x509 -text -in yourfile" print it ?
> - 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
>