Hello, [EMAIL PROTECTED] wrote on 04/10/2008 11:56:50 PM:
> On Thu, Apr 10, 2008 at 11:44:23PM +0200, [EMAIL PROTECTED] wrote: > > > Hello, > > > > > On Thu, Apr 10, 2008 at 10:46:45PM +0200, [EMAIL PROTECTED] wrote: > > > > > > > > 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 ? > > > > Try EVP_PKEY_RSA for RSA key instead of SSL_FILETYPE_ASN1. > > > > > > Is the OP's file a private key or an X.509 certificate? > > Line: > > fp = fopen("../keys/prkey.der", "r"); > > suggest that this is private key. > > The success of "SSL_CTX_use_certificate" seems to point to it being > a certificate. Which is it? Did the OP misreport what worked? Which > was it: > > SSL_CTX_use_PrivateKey_ASN1() > OR > SSL_CTX_use_certificate_ASN1() Yes, indeed. According to OP second function works (after conversion). But first function has bad key type specified. I think that output from command: $ openssl asn1parse -in pekey.der -inform der may be very helpful in this case. Best regards, -- Marek Marcola <[EMAIL PROTECTED]>