I need to load ASN1/DER private key. To do this i use 

FILE *fp;
char in_buf[1000];
fp = fopen("../keys/prkey.der", "r");
len = fread(in_buf, sizeof(char), 1000, fp);
fclose(fp);
if (!len)
 return 0;

if (!SSL_CTX_use_PrivateKey_ASN1(SSL_FILETYPE_ASN1, ctx, (unsigned
char*)in_buf, len))
 ERR_print_errors_fp(stdout);

and all the time i am getting the following error:

7701:error:0D09A0A3:asn1 encoding routines:d2i_PrivateKey:unknown public key
type:d2i_pr.c:125:
7701:error:140AF00D:SSL routines:SSL_CTX_use_PrivateKey_ASN1:ASN1
lib:ssl_rsa.c:690:

I have converted that key to pem format with openssl commandline tool and
loaded with 
SSL_CTX_use_certificate_ASN1(ctx, len, (unsigned char*)in_buf)
It worked. 

Does anybody have any ideas what is wrong with SSL_CTX_use_PrivateKey_ASN1 ?

Thanks in advance.
-- 
View this message in context: 
http://www.nabble.com/Problem-with-SSL_CTX_use_certificate_ASN1-tp16609096p16609096.html
Sent from the OpenSSL - User mailing list archive at Nabble.com.

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to