Hellan,Kim KHE wrote:
> 
> I'm using Win NT4 with Visual Studio 6 and OpenSSL version 0.9.5.
> 
> I'm trying to read a file with a private key using:
> EVP_PKEY* pKey = (EVP_PKEY*) PEM_ASN1_read( (char *(*)())d2i_PrivateKey,
>                         PEM_STRING_EVP_PKEY, fpKey, NULL, NULL, NULL);
> 
> This goes well of the private key is not encrypted, but if the key file is
> encrypted (3DES), PEM_ASN1_read() never returns and the CPU usage goes to
> 100%.
> Since I don't supply a callback function for getting the key password,
> PEM_ASN1_read() should just return a NULL pointer for encrypted key files
> (as it did in earlier versions).
> 
> Is this an error in OpenSSL version 0.9.5?
> 

Applications should not call PEM_ASN1_read(). If you want to read a
private key use PEM_read_PrivateKey() instead.

If you don't supply a callback then it will use the default one which is
console based. This might have failed in previous versions because
you didn't load the algorithms with OpenSSL_add_all_algorithms() (or
equivalent) first.

If you really want it to fail on encryped keys then supply a callback
that returns zero: a return value <=0 is taken as meaning there was a
problem getting the pass phrase.

Steve.
-- 
Dr Stephen N. Henson.   http://www.drh-consultancy.demon.co.uk/
Personal Email: [EMAIL PROTECTED] 
Senior crypto engineer, Celo Communications: http://www.celocom.com/
Core developer of the   OpenSSL project: http://www.openssl.org/
Business Email: [EMAIL PROTECTED] PGP key: via homepage.

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to