Posted on 2008-12-29 21:34:56-08 by noxxi in response to 9608
Re: Need help in designing a ssl perl client connecting to ssl ...
I don't know why you use Net::Telnet to connect to another server, I would suggest either using IO::Socket::INET/INET6 and then upgrading to IO::Socket::SSL:
use IO::Socket::INET; use IO::Socket::SSL; my $sock = IO::Socket::INET->new( $host ) or die $!; IO::Socket::SSL->start_SSL( $sock, SSL_verify_mode => 1, # verify peer certificate SSL_ca_path => '/etc/ssl/certs', # against CA from this dir ) or die "SSL handshake failed: $SSL_ERROR"
or using IO::Socket::SSL directly:
use IO::Socket::SSL; my $sock = IO::Socket::SSL->new( PeerAddr => $host, SSL_verify_mode => 1, SSL_ca_path => '/etc/ssl/certs', ) or die "$SSL_ERROR|$!"
If you don't understand this I would suggest to study the documentation and have a look at the examples and test directory of the distribution: http://search.cpan.org/src/SULLR/IO-Socket-SSL-1.18/example/, http://search.cpan.org/src/SULLR/IO-Socket-SSL-1.18/t
Direct Responses: 9617 | Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.