Ricardo Guerra wrote: > > hi, > > when i do this, i get a segfault on "RSA_check_key(&pubKey)", the public key > is generated via cat priv.key | openssl rs -pubout > pub.key .. the real > problem is using rsa_public_decrypt(), the decrypted data makes no sense.. so > i wondered if the public key was correct, but using RSA_check_key it fails, > but i'm able to use RSA_size(&pubKey) > > { > FILE *file; > if ((file=fopen(name, "r"))== NULL) > return 0; > > // pubKey=*PEM_read_RSAPublicKey(file, NULL, NULL, NULL); > pubKey=*PEM_read_RSA_PUBKEY(file, NULL,NULL,NULL); > fclose (file); > if (RSA_check_key(&pubKey)==1) { > printf("la clave publica es correcta\n"); > printf ("La longitud de la clave es de %d bytes\n", RSA_size(&pubKey)); > } > loadedPub=1; > return loadedPub; > } >
As I mentioned before you are calling the functions incorrectly. Also RSA_check() only works on private keys not public keys. 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]