[EMAIL PROTECTED] wrote:
> Hello!

Hi Peter,

>
> 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.

try PEM_read_bio_PUBKEY() (see 'man pem')

>
> 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.

use PEM_read_bio_PUBKEY() or d2i_PUBKEY() ...

> ps.: is it possible, that the private key file contains the public key
> too?

The public key is included in the normal OpenSSL private key
file (see rsa_asn1.c or dsa_asn1.c or ec_asn1.c (0.9.8-dev)). 

Regards,
Nils
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to