How to decrypt PKCS8 DER private key with a password in crypto ++

I am trying to sign a message using a private key that is encrypted, of course I have a password for it, so I am trying to decrypt the key so that I can use it for signing.

I use C ++ library crypto++, this is the code that I am trying to use to read a key from a file

string keyString;
FileSource fs(keyFileName.c_str(), true, new DefaultDecryptorWithMAC(passphrase, new StringSink(keyString)));

At the same time it rises CryptoPP::DefaultDecryptor::KeyBadErr, I know that I have the correct password, because I was able to decrypt the key using openssl with the following command line:

openssl pkcs8 -inform DER -passin pass:PASSPHRASE < emisor.key

This is my first post, I'm not sure that I follow all the rules to ask a question, but any help or hint will be appreciated.

Hi,

heavy

+3
source share
1 answer

PKCS # 8 , Crypto ++ DefaultDecryptorWithMAC. - http://www.rsa.com/rsalabs/node.asp?id=2130

, Crypto ++ PKCS # 8. ASN.1 crypto , , , , openssl. openssl , PKCS # 8.

+3

All Articles