Ricardo Guerra wrote:
>
> hi all,
>
> i've been having trouble with this pice of code, i get a segmentation fault
> when reading the public key, this is the way i generated both private and
> public keys.
>
> priv Key: openssl genrsa -out priv.key 1024
> pub Key: cat pub.key | openssl rsa -pubout > pub.key
>
> does anyone have any idea about what does this happen?
>
> i'm using rh linux 6.2 with openssl 0.9.6b 9
>
> int FOROLicense::LoadPublicKey (char *name)
> {
> FILE *file;
> if ((file=fopen(name, "rb"))== NULL)
> return 0;
>
> pubKey=*PEM_read_RSAPublicKey(file, NULL, NULL, NULL);
>
> fclose (file);
> loadedPub=1;
> return loadedPub;
> }
Not sure what the pubkey stuff is supposed to be doing. pubKey should be
declared somewhere as:
RSA *pubKey;
then call:
pubKey = PEM_read_RSA_PUBKEY(file, NULL, NULL, NULL);
(not RSAPublicKey).
Steve.
--
Dr Stephen N. Henson. http://www.drh-consultancy.demon.co.uk/
Personal Email: [EMAIL PROTECTED]
Senior crypto engineer, Gemplus: http://www.gemplus.com/
Core developer of the OpenSSL project: http://www.openssl.org/
Business Email: [EMAIL PROTECTED] PGP key: via homepage.
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]