I just figured out that client and server works fine if I generate the certificates using openssl tools.
The difference between the two certification generation is in AuthorityKeyIdentifier extension in child (client/server) cert.
I have openssl-cert-generator.bat, my-cert-generator.bat. I am using RootCA and ServiceProviderCA (the 2 CAs) as input for both generators.
**
RootCA
Issuer=/C=US/O=XYZ, Inc./CN=RootCA
Subject=/C=US/O=XYZ, Inc./CN=RootCA
SerialNum=1d
ServiceProviderCA
Issuer=/C=US/O=XYZ, Inc./CN=RootCA
Subject=/C=US/O=XYZ, Inc./CN=ServiceProviderCA
SerialNum=1e
Subject KeyID=35 cf 22 4b b0 ea 94 f5 39 8f 84 8a 8f 10 de 4b d7 03 e4 e3
**
Generating client.pem using my-cert-generator.bat
Issuer=/C=US/O=XYZ, Inc./CN=ServiceProviderCA
Subject=/C=US/O=XYZ, Inc./CN=opensslClient
Authority Key Identifier Has following info
KeyID=35 cf 22 4b b0 ea 94 f5 39 8f 84 8a 8f 10 de 4b d7 03 e4 e3
Certificate Issuer:
Directory Address:
CN=ServiceProviderCA
O="XYZ, Inc."
C=US
Certificate SerialNumber=1e
**
Generating client.pem using openssl-cert-generator.bat
Issuer=/C=US/O=XYZ, Inc./CN=ServiceProviderCA
Subject=/C=US/O=XYZ, Inc./CN=opensslClient
Authority Key Identifier Has following info
KeyID=35 cf 22 4b b0 ea 94 f5 39 8f 84 8a 8f 10 de 4b d7 03 e4 e3
Certificate Issuer:
Directory Address:
CN=RootCA
O="XYZ, Inc."
C=US
Certificate SerialNumber=1e
When generated using OpenSSL, the KeyID and the SerialNumber are from ServiceProviderCA, but the Certificate Issuer Details refer to RootCA.
As per RFC, the identification may be based on either the key identifier or on the issuer name and serial number. I removed issuer name and serial number from the both generation scripts. Everything is working fine (certificate chain verification is successful)
I used following command in openssl-cert-generator.bat
openssl req -new -key client.key -out client.csr -sha1 -subj "/C=US/O=XYZ, Inc./CN=opensslClient"
openssl x509 -req -days 7300 -CA spca.crt -CAkey spca.key -CAcreateserial -in client.csr -extfile client.ext -out client.crt
#spca - ServiceProviderCA
---- client.ext ----
extendedKeyUsage=serverAuth,clientAuth
authorityKeyIdentifier=keyid:always,issuer:always
keyUsage = critical,digitalSignature,keyEncipherment
---- client.ext ----
Please confirm the following
1) Certificate generation using openssl, embeds RootCA's issuer details instead of ServiceProviderCA's (immediate CA) details (when authorityKeyIdentifier=keyid:always,issuer:always)?
2) When both Issuer KeyID and issuer detail & serial number are specified, and all refer to immediate CA, OpenSSL fails to verify the certificate chain?
thanks
chinmaya
On 12/9/05, [EMAIL PROTECTED] <
[EMAIL PROTECTED]> wrote:
* I tried with -Veify 9 option. No change in the output still fails with same error (unable to get local issuer certificate).
* However with the change in syntax of openssl verify (as you suggested), the verification is failing
server.pem - has only ServerCert does not include ServiceProvideCA
--------- snippet --------
C:\OpenSSL\bin>openssl verify -verbose -purpose sslserver -untrusted \certs\spca.pem -CApath \certs \certs\server.pem
C:\certs\ClientCert.pem: /C=US/O=XYZ, Inc./OU=ABCD/CN=opensslClient
error 20 at 0 depth lookup:unable to get local issuer certificate
--------- snippet --------
Is there way to to know the reason behind the failure?
The certs are NOT generated using openssl. The ServiceProviderCA does not have Extended Key Usage extension, does it make a difference.
> The alternative is to include the intermediate CA in the trusted store and
> they will then be searched for and added automatically.
* I had put the $hash.0 files (incluing ServiceProviderCA) in \certs directory which is included in CApath (-CApath \certs)
thanks
chinmayaOn 12/9/05, Dr. Stephen Henson < [EMAIL PROTECTED]> wrote:On Thu, Dec 08, 2005, [EMAIL PROTECTED] wrote:
> Hi,
>
> I am using to OpenSSL as TLS client and server. I am using certificate chain
> of size 3 on both sides.
>
> On Server Side
> RootCA (root.pem)
> ServiceProviderCA (spca.pem)
> ServerCert (server.pem)
>
> On Client Side
> RootCA (root.pem)
> ServiceProviderCA (spca.pem)
> ClientCert (client.pem)
>
>
> I have placed the certs and the hash files ($hash.0) of all certs in
> c:\certs
>
> I am running server as
> C:\OpenSSL\bin>openssl s_server -Verify yes -cert \certs\server.pem -key
> \certs\server.key -CApath \certs -CAfile \certs\root.pem -tls1
> [also tried without -CAfile option i.e. just with -CApath]
>
> and client as
> C:\OpenSSL\bin>openssl s_client -cipher AES128-SHA -cert \certs\client.pem
> -key \certs\client.key -CApath \certs -CAfile \certs\root.pem -tls1
> [also tried without -CAfile option i.e. just with -CApath]
>
> When above commands are executed, TLS connections gets established, however.
> I get some certificate verification errors (both on server and client sides)
>
> on server side (opensslClient is CN in ClientCert)
> depth=0 /C=US/O=XYZ, Inc./OU=ABCD/CN=opensslClient
> verify error:num=20:unable to get local issuer certificate
> verify return:1
> depth=0 /C=US/O=XYZ, Inc./OU=ABCD/CN=opensslClient
> verify error:num=27:certificate not trusted
> verify return:1
> depth=0 /C=US/O=XYZ, Inc./OU=ABCD/CN=opensslClient
> verify error:num=21:unable to verify the first certificate
> verify return:1
>
> on client side (opensslServer is CN in ServerCert)
> depth=0 /C=US/O=XYZ, Inc./OU=ABCD/CN=opensslServer
> verify error:num=20:unable to get local issuer certificate
> verify return:1
> depth=0 /C=US/O=XYZ, Inc./OU=ABCD/CN=opensslServer
> verify error:num=27:certificate not trusted
> verify return:1
> depth=0 /C=US/O=XYZ, Inc./OU=ABCD/CN=opensslServer
> verify error:num=21:unable to verify the first certificate
> verify return:1
>
>
> However, everying works fine if I have my ServerCert, and ClientCert signed
> directly by RootCA.
> i.e. on server side: RootCA and ServerCert and on client side RootCA and
> ClientCert.
>
> Shouldn't it work with an intermediate certificate (ServericeProviderCA) or
> am I missing any configuration.
> Any input is greatly appreciated
The server and client need to include the intermediate CA(s)
(ServiceProviderCA) in the chain they send to the peer.
This is normally done by an "additional certificates" option but s_client and
s_server don't have those at present.
The alternative is to include the intermediate CA in the trusted store and
they will then be searched for and added automatically.
Steve.
--
Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage
OpenSSL project core developer and freelance consultant.
Funding needed! Details on homepage.
Homepage: http://www.drh-consultancy.demon.co.uk
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List openssl-users@openssl.org
Automated List Manager [EMAIL PROTECTED]
--
regards
Chinmaya S. Narayana-Reddy