>
> Now I'm trying to replace the filepath with char[] which has all characters
> of the file.
>
>
I just did this today. Do something like this, where privateKeyString is
your unsigned char array with your PEM file contents in it:
BIO* bp = BIO_new_mem_buf(privateKeyString, -1); // Create a
new memory buffer BIO.
RSA* privKey = 0;
if(bp)
{
privKey = PEM_read_bio_RSAPrivateKey(bp, 0, 0, 0); // And
read the RSA key from it.
BIO_free(bp);
}
// Now check privKey to make sure it's not NULL!
NOTE: You need to make sure that privateKeyString includes the newline
characters that occur in the file. It won't work without them!
Hope that helps.
Gavin