On Thu, Nov 07, 2002 at 08:56:53PM +0100, [EMAIL PROTECTED] wrote: > > Hello! > > I generate a private key using: > openssl genrsa -out xxx.key 1024 > It contains the private key, but I can get the public key this way: > openssl rsa -in xxx.key -pubout -out yyy.pub > > I can get the private key in a C program using > PEM_read_PrivateKey(..), but I can't find > PEM_read_PublicKey(..) function.
PEM_read_RSA_PUBKEY(...); > > So the question is, how could I get the public_key into an EVP_PKEY > structure from the generated key file. I would use DSA keys too, so I > would prefer EVP_PKEY struct. > > Thanks: > Peter > > ps.: is it possible, that the private key file contains the public key > too? struct { BIGNUM *n; // public modulus BIGNUM *e; // public exponent BIGNUM *d; // private exponent BIGNUM *p; // secret prime factor BIGNUM *q; // secret prime factor BIGNUM *dmp1; // d mod (p-1) BIGNUM *dmq1; // d mod (q-1) BIGNUM *iqmp; // q^-1 mod p // ... }; RSA Read the private key and delete d, p, q, dmp1, dmq1, iqmp and you have a public key :-) (man 3 RSA) Christian > > ______________________________________________________________________ > OpenSSL Project http://www.openssl.org > User Support Mailing List [EMAIL PROTECTED] > Automated List Manager [EMAIL PROTECTED] ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]