Hi,
I need to load RSA Public key which is stored in the char buffer. I came
across d2i_RSA_PUBKEY function to do the same (Please correct me if I am
wrong here).
When I use this function, RSA Public key is not getting loaded.
In the main, i have the following function call:
loadRSAPubKey("MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0yepYbVklwYuwGEmenQhVwyddHGdM26rZqWG5tFFPYz1QA51EJ44thSejrbRKHqV/EmqU8wwuFeaDmxnVz6UhG3HfjuTbAkkuZ+boEIealr/Ml+kHqRgzQ6G1rP9+5goboZzlpB9b8zYvp+5my5xFCd8OqyoKKyoHBJ3Tf0NCSstow7k0W/5JMeDa844HpCK4rOxlUaIGsDGTC/XIJ93EQs8yT4js5iw++pJslQvh1RzeQtzLQ8xNGYKlr9RyIvh2S28qXb+qfEx7r+kG8RjS4jc3E3XR/nja7HXnAFWCgF/cRcj5aQHq02scW8Vi+iBS/A1Y5RD2QMxJqY1yxC28QIDAQAB");
int loadRSAPubKey(char *key)
{
const unsigned char *p = key;
int keylen = strlen(key);
prsa_loaded = (RSA *)d2i_RSAPublicKey(NULL, &p, keylen);
if(!prsa_loaded)
{
printf("Failed to load RSA key\n");
exit(0);
}
return 1;
}
It was always saying "Failed to load RSA Key" and exiting...
Am i missing something here??
Could you please help me out.
Thank you.
regards
Praveen
--
View this message in context:
http://openssl.6102.n7.nabble.com/Usage-of-d2i-RSA-PUBKEY-function-tp42353.html
Sent from the OpenSSL - User mailing list archive at Nabble.com.
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [email protected]
Automated List Manager [email protected]