Hi !
I need read a public key from pem file (this file content ONLY the public key).
This public key can be RSA,DSA....... For this reason i try use:
EVP_PKEY *clave_publica=NULL;
clave_publica = EVP_PKEY_new();
int lee_clave_publica(char *fichero_publica)
{
BIO *bp_publica;
OpenSSL_add_all_algorithms();
SSLeay_add_all_algorithms();
bp_publica=BIO_new(BIO_s_file());
if (BIO_read_filename(bp_publica,fichero_publica) <= 0)
{
printf("ERROR");
BIO_free(bp_publica);
return 0;
}
if ((clave_publica=PEM_read_bio_PUBKEY(bp_publica,NULL,0,NULL)==NULL)
/*Always clave_publica==NULL !!!!!!!!!!!!!*/
{
printf("ERROR");
BIO_free(bp_publica);
return 0;
}
BIO_free(bp_publica);
return 1;
}
Finally in the main function when I finish my work , I write:
EVP_PKEY_free(clave_publica);
But always the pem_read_bio_pubkey return null
Can anybody help me?
Thanks,
lidia
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]