On 23 Jul 2002 17:44:15 -0000, ganesh kumar godavari wrote: > hello group, > i have create RSA private key using > openssl genrsa -out KEY.pem 1024 > openssl rsa -in KEY.pem -out private.pem > openssl rsa -in KEY.pem -pubout -out public.pem >
hi first, you don't need to call openssl rsa -in KEY.pem -out private.pem the first command "genrsa" generates a private key already, so you'll have: openssl genrsa -out private.pem 1024 openssl rsa -in private.pem -pubout -out public.pem > > i try to read the public.pem the following way > [snip] > > if ((x=(RSA *)PEM_read_RSAPublicKey(fp,NULL, NULL,NULL)) != > NULL) [snip] > > it gives me an error saying that > that's because there's two ways to read public keys. a public key can be rsa, dsa and dh (may be more in openssl i don't remember now). with the function PEM_read_RSAPublicKey OpenSSL is expecting a concrete RSA Public key which will have in the header of the PEM file -----BEGIN RSA PUBLIC KEY----- instead of -----BEGIN PUBLIC KEY----- if you'd like to load an RSA key with the "BEGIN PUBLIC KEY" header, you should use PEM_read_RSA_PUBKEY function instead of the one you use. this header will be common for dsa, rsa and dh keys. uppps... got to catch the bus. hope this helps you. regards, aleix ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]