RSA key formats

15 views
Skip to first unread message

Concept

unread,
Jan 8, 2007, 3:36:44 PM1/8/07
to Crypto++ Users
I am currently using 1024 bit RSA encryption, and I need to support
openPGP key files.

I can convert the BER encoded private key file to openPGP easily
enough, but converting from openPGP to a BER encoded file is difficult
because it doesn't have the dmp1 (m_dp) and dmq1 (m_dq) values stored.
I really don't want to have to write my own functions to compute them.

Is there a way to read/write directly to an openPGP compatible format?

Concept

unread,
Jan 8, 2007, 5:03:54 PM1/8/07
to Crypto++ Users
Let me rephrase. I have been just using the crypto++ BEREncoded key
files locally, but I don't know how to export or import them to other
formats, specifically ascii armored OpenPGP.

Crypto++ uses BER encoding to read and write the public key in X509,
and the private key in PKCS#8. I need to read and write ascii armored
files, which I know how to do independently, but I don't know how to
use them with crypto++.

I could actually do it the hard way and convert the formats externally,
except that I would have to do the aforementioned math. Once I get
into implementing parts of the RSA algorithm, I think I'm going too
far, and I need to figure out how I was supposed to do it within the
library, and that's the question.

Jeffrey Walton

unread,
Jan 8, 2007, 5:16:54 PM1/8/07
to Concept, Crypto++ Users
H Concept,

> ...because it doesn't have the dmp1 (m_dp) and dmq1 (m_dq)
> values stored.
It's part of the private key (p and q). Is Load() throwing and error?
Forgive my ignorance - I've never tried to load a PGP key. But I
thought Crypto++ has PGP support (though I don't know all the
details).

I recently tried the encoding/decoding. See
http://groups.google.com/group/cryptopp-users/browse_frm/thread/3fb20aaa9b71de8c/b0f9438b7feba5e7?hl=en&

For a private key, call Load() on an decryptor (I'm not sure if an
Encryption object has the other parameters besides the public
exponent).

Jeff

Wei Dai

unread,
Jan 8, 2007, 8:10:38 PM1/8/07
to Crypto++ Users
On Jan 9, 4:36 am, "Concept" <kost...@imagehawk.com> wrote:
> I can convert the BER encoded private key file to openPGP easily
> enough, but converting from openPGP to a BER encoded file is difficult
> because it doesn't have the dmp1 (m_dp) and dmq1 (m_dq) values stored.
> I really don't want to have to write my own functions to compute them.

Crypto++ provides a function to compute p and q given just n, e, and d.
It's the third Initialize() function of InvertibleRSAFunction class in
rsa.h.

Reply all
Reply to author
Forward
0 new messages