Sorry, our fault, everything works fine as described.

The only reason it didn't before was, that we created a class that shall
handle the SSL initialization and DEinitialization. And instead of
creating an object of this class we only called it's constructor:

OurApplication(argc, argv);

instead of

OurApplication app(argc, argv);

Konrad Kleine schrieb:
> Hello,
> 
> we want to read in this private key using buffer BIO (no other BIO like
> the fp version!):
> 
> -----BEGIN RSA PRIVATE KEY-----
> Proc-Type: 4,ENCRYPTED
> DEK-Info: DES-EDE3-CBC,ABC593E89A1C77DC
> 
> VRFgc0wejrAxwsGZud6I7IMVV30ZAHGu2Xl5BASjuBwjw4LB22UVAvNuCJRHRlOu
> 6UI774NZamj6Tme1UgdyP6S3jtISEFhcJKQ5ldudBRfEKsW5hu/DGR7ZRz9hT365
> ISmbudSl35Eq+GYqT666Vng9ELyYwlNI3G02F2pmLwahNVMTbGtJxHZ/c2pqJzel
> flPww/4AVm4aRi4PBwFt8+Tf2xTGKeIb+b795Aq6pfoiQnnLf1sLB2JjX7L6OUsO
> VuDFb0dt/h82/T71+/5Oc2g+51sD2w+UjIlo8mXYTxX3d6Dsw7a6sSKRHg+C4h4o
> /s4rKH+e1YV9AtFl9n5EOGTjov6oOCwuEAmphR97k4puR1aQaiC05zz3nsRxDf6q
> ddWgfv+I4uPB7qA1VwNClwTr93cDnAAyBphMFygAuP5Dob3uJ2FerBmyMVxSKjZC
> CDPhY9qLWvQwMeAZPhEJCfw3X49hPlA/svFqPThqMKKozqOsTtf4VL4fI67lTLag
> ApEnmuLpR1PLfhlyYeJEgTB3sWB8wnmflnlHYK1c7PicFm2wfYqCWmLZ+iE7cX9v
> i/aMJA1XYngCJnh2gaThRJIs5Wwd0pCBHN8Y5GTV5Q4Yx3q0uwob2w==
> -----END RSA PRIVATE KEY-----
> 
> The above key has been create using this command:
> 
> "openssl genrsa -des3 -passout pass:fints -f4 -out privateKey.pem 768"
> 
> Therefore we need to provide the passphrase "fints" when reading the BIO in.
> 
> We read in the file contents and created a buffer BIO:
> 
> // Callback to disable console passphrase input
> int disable_passphrase_prompt(
>       char *buf,
>       int size,
>       int rwflag,
>       void *u)
> {
>         return 0;
> }
> 
> // Extracted from out code that reads in the from the buffer BIO
> // ...
> void * u = (void*) "fints";
> BIO * bio = BIO_new_mem_buf(fileContents, sizeOfContents);
> RSA * rsa = PEM_read_bio_RSAPrivateKey(
>               bio,
>                 0,
>                 u==0 ? disable_passphrase_prompt : 0,
>                 u);
> 
> if (rsa == 0)
> {
>       char buffer[120];
>         ERR_error_string(ERR_get_error(), buffer);
>       fprintf(stderr, "OpenSSL error: %s", buffer);
> }
> // ...
> 
> The error output goes like this:
> 
> "error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag"
> 
> What are we doing wrong?
> 
> Thanks in advance
> Konrad
> ______________________________________________________________________
> OpenSSL Project                                 http://www.openssl.org
> User Support Mailing List                    openssl-users@openssl.org
> Automated List Manager                           [EMAIL PROTECTED]
> 
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to