But this fails:#!/usr/local/bin/perl -w # DEBUGGING SWITCH / LOW LEVEL SSL DIAGNOSTICS $ENV{HTTPS_DEBUG} = 1; # DEFAULT SSL VERSION $ENV{HTTPS_VERSION} = '3'; # CLIENT PKCS12 CERT SUPPORT $ENV{HTTPS_PKCS12_FILE} = 'test.p12'; $ENV{HTTPS_PKCS12_PASSWORD} = 'PASSWORD'; use strict; use WWW::Mechanize; my $agent = WWW::Mechanize->new( autocheck => 1 ); # Can we access the host? my $response = $agent->get("https://hostname/secure/area"); print $response->content;
The only explanation I have found for 'certificate unknown' in the spec is not terribly helpful: "Some other (unspecified) issue arose in processing the certificate, rendering it unacceptable." To verify that the certificate was not the problem I took the PKCS12 keybag and made some PEM files like so:SSL_connect:before/connect initialization SSL_connect:SSLv3 write client hello A SSL_connect:SSLv3 read server hello A SSL_connect:SSLv3 read server certificate A SSL_connect:SSLv3 read server done A SSL_connect:SSLv3 write client key exchange A SSL_connect:SSLv3 write change cipher spec A SSL_connect:SSLv3 write finished A SSL_connect:SSLv3 flush data SSL_connect:SSLv3 read finished A SSL_connect:SSL renegotiate ciphers SSL_connect:SSLv3 write client hello A SSL_connect:SSLv3 read server hello A SSL_connect:SSLv3 read server certificate A SSL_connect:SSLv3 read server certificate request A SSL_connect:SSLv3 read server done A SSL_connect:SSLv3 write client certificate A SSL_connect:SSLv3 write client key exchange A SSL_connect:SSLv3 write certificate verify A SSL_connect:SSLv3 write change cipher spec A SSL_connect:SSLv3 write finished A SSL_connect:SSLv3 flush data SSL3 alert read:fatal:certificate unknown SSL_connect:failed in SSLv3 read finished A Error GETing https://hostname/secure/area: read failed: error:14094416 +:SSL routines:SSL3_READ_BYTES:sslv3 alert certificate unknown | error +:140940E5:SSL routines:SSL3_READ_BYTES:ssl handshake failure at ./tes +t.pl line 26
Then I tried connecting using the s_client app that comes with OpenSSL:openssl pkcs12 -in test.p12 -out test.crt -clcerts -nokeys openssl pkcs12 -in test.p12 -out test.key -nodes -nocerts openssl pkcs12 -in test.p12 -out cacerts.crt -nokeys -cacerts
And then I tried to GET /secure/area and was successful. Unfortunately, C::S only contains options related to client verification of the server's certificate, there is no way that I can see to pass the equivalent of -CAfile cacerts.crt. I think a patch might be in order, but I don't know where to begin. Help. -- Sean Evansopenssl s_client -cert test.crt -key test.key -CAfile cacerts.crt -con +nect hostname:443
In reply to Crypt::SSLeay & client certificate authentication by daigidan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |