|
osdir.com mailing list archive F.A.Q. -since 2001! |
|
|
|
Subject: Re: RSA Private Key BER decode error - msg#00016List: encryption.cryptopp
by Date: Prev Next Date Index by Thread: Prev Next Thread Index
Hi Private Key Should be in BER format as I see the private key is encrypted with DES-ede 1- so u have to Get the private Key from the body of the file 6EbssRIDXh8t1lC9xmLvMBlbYoZgCm/ah78JkAjKLdF+zjzftanshMYLWLasp3NM
VvWBs5KJVNbfAIewGcXy+eQQWrRc9yk7KtBK4ziSoWgPmYieKUX+KFi/XRWbVVv4 ... 2- decode it base 64 3- decrypt it with DES-ede to get the plain RSA private key 4- encode the private key using base64 encoding Regards Haytham "gvalenz (sent by Nabble.com)" <lists@xxxxxxxxxx> wrote: Hello, I have a Private Key File as the following example: -----BEGIN ENCRYPTED PRIVATE KEY----- Proc-Type: 4,ENCRYPTED DEK-Info: DES-EDE3-CBC,0F6D6F770782C99A 6EbssRIDXh8t1lC9xmLvMBlbYoZgCm/ah78JkAjKLdF+zjzftanshMYLWLasp3NM VvWBs5KJVNbfAIewGcXy+eQQWrRc9yk7KtBK4ziSoWgPmYieKUX+KFi/XRWbVVv4 ... -----END RSA PRIVATE KEY----- When I try to use the following sample code of Crypto++ I get an exception. {I get the error on line: RSAES_OAEP_SHA_Decryptor priv(privFile);} string RSADecryptString(const char *privFilename, const char *ciphertext) { string result; try { FileSource privFile(privFilename, true, new HexDecoder); RSAES_OAEP_SHA_Decryptor priv(privFile); StringSource(ciphertext, true, new HexDecoder(new PK_DecryptorFilter(GlobalRNG(), priv, new StringSink(result)))); } catch (CryptoPP::Exception const& e) { cout << "CryptoPP::Exception caught:" << endl << e.what() << endl; cout << e.GetErrorType() << endl; return "1"; } return result; } The exception is: CryptoPP::Exception caught: BER decode error 1 Does somebody suggest me something to solve this issue? I am new on Crypto++ and security concepts? Thank you in advance. -- View this message in context: http://www.nabble.com/RSA-Private-Key-BER-decode-error-t1787416.html#a4868885 Sent from the Crypto++ forum at Nabble.com. Ring'em or ping'em. Make PC-to-phone calls as low as 1¢/min with Yahoo! Messenger with Voice.
Thread at a glance:
Previous Message by Date:RSA 128 bits private key issue cryptopp 5.2.1 Visual C++ 6.0Hi all, I'm using cryptopp 5.2.1 with Visual C++ 6.0. I create a RSA private key of 128 bits long, with an associate public key, I have used the exemple program to do this. I'm trying to encrypt a text of 1 characters size, and cryptopp throw an exeception saying that the text is too long for the key. That's a normal message ? Does cryptopp support RSA Key of 128 bits? Thank you in advance. Alex Next Message by Date:DH-Domain Parameter in PKCS#3 encoding?Hi all! Just a short question: Does crypto++ support decoding of DH domain parameters in PKCS#3 encoding? DHParameter ::= SEQUENCE { prime INTEGER, base INTEGER, privateValueLength INTEGER OPTIONAL} While stepping through the code it just seems to support a different encoding very similar to that one above, but definitely not the same (it tries to decode subgroup generators, probably regarding X9.42?). I don't find any other way to use the PKCS#3 encoding correctly. I'm using the following code: CryptoPP::ByteQueue bqDomain; bqDomain.Put(m_DomainParameter.data(), m_DomainParameter.size()); if (m_strAlgorithm.compare(ALG_DH) == 0) { m_pDH = new CryptoPP::DH(bqDomain); CryptoPP::AutoSeededRandomPool randPool; bool bValidate = m_pDH->GetCryptoParameters().Validate(randPool, 3); : : } The validation of course fails.... Best regards ----- Norbert A. Richartz Previous Message by Thread:RSA Private Key BER decode errorHello, I have a Private Key File as the following example: -----BEGIN ENCRYPTED PRIVATE KEY----- Proc-Type: 4,ENCRYPTED DEK-Info: DES-EDE3-CBC,0F6D6F770782C99A 6EbssRIDXh8t1lC9xmLvMBlbYoZgCm/ah78JkAjKLdF+zjzftanshMYLWLasp3NM VvWBs5KJVNbfAIewGcXy+eQQWrRc9yk7KtBK4ziSoWgPmYieKUX+KFi/XRWbVVv4 ... -----END RSA PRIVATE KEY----- When I try to use the following sample code of Crypto++ I get an exception. {I get the error on line: RSAES_OAEP_SHA_Decryptor priv(privFile);} string RSADecryptString(const char *privFilename, const char *ciphertext) { string result; try { FileSource privFile(privFilename, true, new HexDecoder); RSAES_OAEP_SHA_Decryptor priv(privFile); StringSource(ciphertext, true, new HexDecoder(new PK_DecryptorFilter(GlobalRNG(), priv, new StringSink(result)))); } catch (CryptoPP::Exception const& e) { cout << "CryptoPP::Exception caught:" << endl << e.what() << endl; cout << e.GetErrorType() << endl; return "1"; } return result; } The exception is: CryptoPP::Exception caught: BER decode error 1 Does somebody suggest me something to solve this issue? I am new on Crypto++ and security concepts? Thank you in advance. -- View this message in context: http://www.nabble.com/RSA-Private-Key-BER-decode-error-t1787416.html#a4868885 Sent from the Crypto++ forum at Nabble.com. Next Message by Thread:RSA 128 bits private key issue cryptopp 5.2.1 Visual C++ 6.0Hi all, I'm using cryptopp 5.2.1 with Visual C++ 6.0. I create a RSA private key of 128 bits long, with an associate public key, I have used the exemple program to do this. I'm trying to encrypt a text of 1 characters size, and cryptopp throw an exeception saying that the text is too long for the key. That's a normal message ? Does cryptopp support RSA Key of 128 bits? Thank you in advance. Alex
blog comments powered by Disqus
|
|