Hello,
I want to write a private RSA key to a file with PEM encoding.
I found the PEM_write_RSAPrivateKey function in the pem.h headerfile.
It seems to me that it does exactly what I want. But when I use it, all I
can do is write to stdout. Even with the code below, the PEM encoded key
appears
on stdout.
//
// Open the file (some errorcheckingcode is removed in this post)
//
fdOut=fopen(sOutputKey,"w");
//
// Write PEM (rsa is a pointer to the RSA structure holding the key)
//
PEM_write_RSAPrivateKey(fdOut, rsa, NULL,NULL,0,NULL,NULL);
//
// Close file
//
fclose(fdOut);
I also tried it with BIO structures (code found in the documentation
pages), but
it gave me identical results... The PEM encoded string is always written to
stdout.
I wanted to try the latest openssl version, but although it compiles
without a problem,
my program crashes at the first call to an openssl routine. (I use Visual
C++ v6).
Am I doing something wrong? I'm using Openssl 0.9.4.
Thanks on advance,
Dirk
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]