Hi,
I was going the example like above in order to sign a message (a char
array), but the PEM_read_bio_ECPrivateKey keeps giving back NULL.
Here is my code:
unsigned char tempkey[100]; // buffer for the EC key
int hdrlen = 31;
int ftrlen = 32;
memcpy(tempkey,"-----BEGIN EC PRIVATE KEY-----\n",hdrlen); // This is
supposedly the required header
memcpy(&tempkey[hdrlen],m_Private_key,32); //m_Private_key is a 32 byte
unsigned char array
memcpy(&tempkey[hdrlen+32],"==\n-----END EC PRIVATE KEY-----\n",ftrlen); //
This is supposedly the
// required footer
tempkey[hdrlen+32+ftrlen] = 0; // NULL terminate just in case
BIO* in;
EC_KEY *pkey;
in=BIO_new_mem_buf(tempkey,hdrlen+ftrlen+32);
pkey=PEM_read_bio_ECPrivateKey(in, NULL, NULL, NULL); //Try to get an EC_KEY
from tempkey
And right there, pkey is returned to me as NULL. Does anyone know why this
happen? Please advise me if you can. Thank you.
--
View this message in context:
http://old.nabble.com/Bug-in-ECDSA_do_sign--tp1071562p33872498.html
Sent from the OpenSSL - Dev mailing list archive at Nabble.com.
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [email protected]
Automated List Manager [email protected]