Hi ,
I have written this simple function to read server certificate, but it always return -1.
int RSAEncryptPublickey(unsigned char *from , unsigned char *to)
{
assert( from && to );
unsigned char * rsa = new unsigned char ;
FILE * fp = fopen(PublickeyFile , "rb" ) ;
if ( !fp ) return -2 ;
rsa = (unsigned char *) PEM_read_RSAPublicKey( fp,(RSA **) rsa , 0 ,NULL);
fclose( fp ) ;
if ( !rsa )
return -1;
return RSA_public_encrypt ( (int ) strlen ( (char *) from ) , from , to , rsa ,RSA_PKCS1_PADDING );
}
would you please help me what should i do ?
thank
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
