I have generated a pair of private/public keys and I have managed to load the private key to sign some bytes. The problem ocurrs when I try to load the public key from memory to verify the signature.
Here is some code :
privateKey := BIO_new(BIO_s_mem);
PEM_write_bio_RSAPrivateKey(privateKey,rsa,enc,nil,0,nil,PChar('1234567890'));
publicKey := BIO_new(BIO_s_mem);
PEM_write_bio_RSAPublicKey(publicKey,rsa);
WriteLn(GetErrorMessage);
//No error so far
Writeln('Keys generated!');
pKey := nil;
PEM_read_bio_PrivateKey(privateKey,pKey,nil,PChar('1234567890'));
// pKey is ok
mKey := nil;
PEM_read_bio_PUBKEY(publicKey,mKey,nil,nil);
WriteLn(GetErrorMessage);
The error message output by the last line is
PEM routines : PEM_read_bio : no start line
What am I doing wrong ?