Yeah, I just noticed that.

I've been comparing how my intermediate CA resigned an existing cert
(it's part of a proxy that decrypts, examines, and reencrypts -- the
downstream client sharing a trust hierarchy with the intermediate
"resigning" CA) with what "OpenSSL ca ..." does.

OpenSSL ca ... actually puts the issuer of the issuer into the AKID
issuer field of the signed cert, along with the issuer serial number.
When the issuer is a root ca, it is it's own issuer, so the issuer
(which is what my resigning code was using), and issuer's issuer are the
same. But, when the issuer is an intermediate CA, they are different.
  
So, either I'm doing it wrong, or OpenSSL ca ... Is doing it wrong (but
consistent with how OpenSSL verify ... checks).

At this point, I think the error is mine. At least browsers accept the
cert when OpenSSL signs it with an intermediate CA, and not when I do.

Think about it: the purpose of the AKID is to identify the public key of
the signer, either by matching the SKID of the signer, or some other
means of identifying the signer. Well, the signer's serial number is
unique within those issued by IT'S signer, so the combination of IT's
signer and IT's serial number should be probabilistically unique.

This whole SKID/AKID mess comes about because issuer and subject DNs are
not guaranteed to be globally unique, but the combination of issuer's
issuer DN, and issuer's serial number within the issuer's issuer's DN
are statistically more so. (Without SKID/AKID, one would have to verify
a prospective issuer by unhashing the signature with the issuer's public
key, which is arguably more computationally expensive that comparing
SKID and AKID. One should still do this anyway, but the SKID/AKID check
preemptively eliminates the wrong issuer).

Sigh. X500 looks like a royal "designed by non-technical committee"
mess.

Thanks for the help, now excuse me while I make a code change.

-----Original Message-----
From: owner-openssl-us...@openssl.org
[mailto:owner-openssl-us...@openssl.org] On Behalf Of Giang Nguyen
Sent: Thursday, March 12, 2009 4:56 PM
To: openssl-users@openssl.org
Subject: RE: Can't recognize intermediate CA



> I used openssl with the intermediate CA to sign a separate cert, which

> had a AKID keyid but no issuer, and that chain recongizes fine.
>
> Could the problem be the fact that yahoo.pem has an AKID keyid AND 
> issuer? (onr or the other is sufficient, but I could find nothing that

> said that both were illegal).

it might be a bug in openssl X509_check_issued() function.

im using openssl 0.9.8i.

line 650 in v3_purp.c:

            if(nm && X509_NAME_cmp(nm, X509_get_issuer_name(issuer)))
                return X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH;

nm is the DirName thing in the subject cert's AKID, ie
"/O=WatchGuard_Technologies/OU=Fireware/CN=Resigning_CA"
and "issuer" is the intermediate CA cert, so its
"X509_get_issuer_name(issuer)" will be name of root CA.
so the comparsion will fail, and you get the error.

looks like it should be "X509_get_subject_name(issuer)"
_________________________________________________________________
Windows Live(tm) Groups: Create an online spot for your favorite groups
to meet.
http://windowslive.com/online/groups?ocid=TXT_TAGLM_WL_groups_032009____
__________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to