On Mon, Nov 08, 2004 at 04:27:14PM -0600, Sundar Raman wrote: > I've got known private and public rsa keys in hex format, including all > the parameters (n, p, q, etc.). I know that i can use genrsa to generate > keys into a .pem file that can subsequently be passed to enc to > encrypted some data. however, i need to be able to use the keys that i > have been provided. is there a way to convert the hex values to the > format that the .pem files should be in (or a way for enc to accept the > hex values directly)?
struct rsa_st in rsa.h says that n, e, d, p, q, etc. are BIGNUM. bn.h tells you about BN_bin2bn. So you can use prepare your hex strings appropriately, use BN_bin2bn to convert them to BIGNUMs, then populate your struct rsa_st. You'll want to check out how RSA_generate_key does it to make sure you maintain rsa_st's internal consistency. HTH. -- Ng Pheng Siong <[EMAIL PROTECTED]> http://sandbox.rulemaker.net/ngps -+- M2Crypto, ZServerSSL for Zope, Blog http://www.sqlcrypt.com -+- Transparent AES Encryption For SQLite ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]