I'm trying to use private key from memory buffer to be able to load it to ctx using SSL_CTX_use_RSAPrivateKey_ASN1. I have no problems no problems do it for certificate itself using buf =certificate; x = d2i_X509(NULL,&buf,sizeof certificate; if(x != NULL) { if (1 != SSL_CTX_use_certificate(_ctx, x)){ ULONG iError = ERR_get_error(); char *szError = ERR_error_string(iError,NULL); } else { ULONG iError = ERR_get_error(); char *szError = ERR_error_string(iError,NULL); } I got this certificate buffer using -C option for openssl x509. But the problem is there is no such options with openssl rsa. What i did is i removed password from private key and the converted it to der:
openssl rsa -inform PEM -outform DER -in file.pem -out file.der. after i tried FILE *fp = fopen("file.der", "rb"); fseek(fp,0,SEEK_END); long lsize = ftell(fp); fseek(fp, 0,SEEK_SET ); unsigned char *buffer = new unsigned char[lsize]; size_t len = fread(buffer,1,lsize, fp); buf=buffer; if (1 != SSL_CTX_use_RSAPrivateKey_ASN1( _ctx, buf, len)){ ULONG iError = ERR_get_error(); char *szError = ERR_error_string(iError,NULL); } I'm getting just errors here. I suspect that there is some issue with file.der. How should I fix this problems? With kind regards Andrew Andreev ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]