in reply to Certificate host verification with Net::SSLeay::post_https

To verify the server name against the certificate, I use IO::Socket::SSL. For example...
#!/usr/bin/perl use strict; use warnings; use IO::Socket::SSL qw(debug3); use Net::SSLeay qw(post_https); $Net::SSLeay::ssl_version = 3; $|=1; my $host = 'pause.perl.org:https'; my $port = 443; my $client = IO::Socket::SSL->new( PeerAddr => $host, PeerPort => $port, Proto => 'tcp', SSL_version => 3, SSL_use_cert => 0, SSL_verifycn_scheme => 1, ) or warn &IO::Socket::SSL::errstr; print "Connected\n"; print $client "GET / HTTP/1.0\r\n\r\n"; $client->verify_hostname($host, 'http'); my ( $subject, $issuer, $cn ); print $subject = $client->peer_certificate('subject'); print $issuer = $client->peer_certificate('issuer'); $client->close( SSL_no_shutdown => 1 );

Replies are listed 'Best First'.
Re^2: Certificate host verification with Net::SSLeay::post_https
by OtcFormula (Novice) on Nov 13, 2011 at 04:13 UTC

    Please remember, I must authenticate with a client certificate.

    I initially wanted to use IO::Socket::SSL, actually. But I've yet to find support for client certificate authentication with it, hence my use of Net::SSLeay instead.

    If you know a way to specify a client certificate for authenticating when using IO::Socket::SSL, I'm most certainly all ears with much interest.