Thanks for the reply. But my problem is still there.

Upon your suggestion, I got newer version of crypto\x509v3\v3_purp.c 
and rebuilt the openssl library with debug. I found the change 
couldn't fix my problem since that bug was in the case of checking 
CA's purpose (ca!=0). But my case is DEPTH_ZERO_SELF_SIGNED_CERT (ca==0).

During debugging into v3_purp.c, it was the macro 'ku_reject' which 
returned TRUE that caused check_purpose_ssl_server returned 0, 
and then made X509_V_ERR_INVALID_PURPOSE happen. The status  
in check_purpose_ssl_server was
        X509* x->ex_flag = 0x133
                x->ex_kusage = 0x06
The first one matched EXFLAG_KUSAGE (0x02) while the second differed from 
KU_DIGITAL_SIGNATURE|KU_KEY_ENCIPHERMENT (0x80).

I found that ex_kusage was defined from
X509.cert_info->extensions->value->date. 
But I don't understand what 'data' means and where and how they are
assigned? 
Can anyone tell me what's wrong there? Is the self-signed certificate not 
defined properly?

Hua
-----Original Message-----
From: Dr Stephen Henson [mailto:[EMAIL PROTECTED]]
Sent: Friday, July 21, 2000 4:01 PM
To: [EMAIL PROTECTED]
Subject: Re: invalid purpose?


Hua Wu wrote:
> 
> Hi, there,
> 
> I am new in SSL and have a problem on verifying a self-signed certificate.
> 
> I am working on client side. When verify a self-signed certificate, I
> suppose
> to get the verify_result =  X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT.
> But actually, I received X509_V_ERR_INVALID_PURPOSE.
> 
> I debugged in verify_callback and observed three continue entries. The
> ctx->error
> of the fist entry was X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT.
> But it was changed immediately to X509_V_ERR_INVALID_PURPOSE in the
> 2nd and 3rd entries.
> 
> The question is
> 
> 1. How can I keep X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT as
> the final error which is what I expected and may be used later?
> 
> 2. Why the error became invalid purpose? I didn't set purpose in my SSL
> session.
> So SSL should select its default (X509_PURPOSE_SSL_SERVER).
> 

There is a bug in the SSL server verification purpose code which is
fixed in the latest development version. That might be it, to check try
using crypto\x509v3\v3_purp.c from the latest snapshot.

Also 0.9.5a verify has an additional feature not in previous versions of
OpenSSL. Previous versions would give the error
X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT for any self signed certificate
now the verify will succeed if the self signed certificate is included
in the trusted store.

If none of that helps why don't you include the certificate that gives
the error?

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
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to