for the followup on this post see this post at:

http://groups.google.com/group/cryptopp-users/browse_thread/thread/d784da6766ff70e6

btw the certificate is from an online example ;)

Thanks vadim

On Dec 2, 11:19 pm, Vadym Fedyukovych <[email protected]> wrote:
> On Mon, Nov 30, 2009 at 10:14:43AM -0800, adfm wrote:
> > Hello all,
>
> > my problem:
> > 1. I have been given a certificate in a pfx form that contains the
> > private key I must use to decode a message.
>
> pfx is likely a PKCS-12 defined by RSA Labs
>
> a private key and a cerificate are likely there in the PKCS-12 structure
>
> "openssl pkcs12 -in yourfule"  might be useful to see exactly what is there
>
> please remember not to post a production private key to the list
>
> > 2. I opened up the certificate and saved the private key data to
> > a .pem file.
> > 3. The certificate is in the form:
>
> > -----BEGIN CERTIFICATE-----
> > MIICuzCCAiSgAwIBAgIJAMLZ1aXsvPdqMA0GCSqGSIb3DQEBBQUAMGkxCzAJBgNV
> > (...)
> > /9kfj2B6h78n9yXo339Xa8i/+3xJQMApR5yXW0IkEg==
> > -----END CERTIFICATE-----
>
> > I went through the examples and found the cool function
> > string RSADecryptString(const char *privFilename, const char
> > *ciphertext)
> > I tried to use it, but I am getting a "BER decode error".
>
> > {
> > string b64decoded;
>
> >         //decode file from bsae 64
> >         StringSource( privFilename, true,
> >                         new CryptoPP::Base64Decoder(
> >                             new CryptoPP::StringSink( b64decoded )
> >                         ) // Base64Encoder
> >                     ); // StringSource
>
> >         //Set up the decryptor
> >         StringSource priv_key(b64decoded, true, new HexDecoder);
> >         RSAES_OAEP_SHA_Decryptor priv(priv_key);
>
> >         //to replace GlobalRNG that I haver no idea where it is!
> >         AutoSeededRandomPool rng;
>
> >         string result;
> >         StringSource(ciphertext, true, new HexDecoder(new
> > PK_DecryptorFilter(rng, priv, new StringSink(result))));
>
> >         return result;
> > }
>
> > Sorry for the dumb question, but I'm learning about cryptography as I
> > go and my time is running short for going through the cryptoPP API's
> > thoroughly.
>
> > I hope that someone can help me out.
>
> > Thanks in advance!
>
> > 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 
> > athttp://www.cryptopp.com.

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