Hello,
I am trying to use the PEM_read_RSAPrivate_Key method. I do something like this
//-------------
FILE * fp = fopen ( "myprivatekey.pem", "r" );
if ( PEM_read_RSAPrivate_Key ( fp , NULL, 0, "MyPassword" ) == NULL )
{
// Wrong password
}
//-------------
the PEM_read_RSAPrivate_Key method is throwing an access violation and I do not know why. I debuged OpenSSL and the line that is throwing it is the fgets ( buf, len, (FILE*)bp->ptr); Now in my debug session, buf is valid, len is valid ( set at 254 ), and bp->ptr is valid, it returns the same address as the one I created with the fopen. I do not understand how this could happen. Does anyone have any insight? Or know of a different way to use PEM_read_RSAPrivate_Key. Thanks.
bss_file.c
static int MS_CALLBACK file_gets(BIO *bp, char *buf, int size)
{
int ret=0;
buf[0]='\0';
fgets(buf,size,(FILE *)bp->ptr);
if (buf[0] != '\0')
ret=strlen(buf);
return(ret);
}
-------------------------------------
Andrew T. Finnell
Software Engineer
eSecurity Inc
(321) 394-2485