/usr/share/doc/libio-socket-ssl-perl/examples/ssl_client.pl is in libio-socket-ssl-perl 1.965-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | #
# a test client for testing IO::Socket::SSL-class's behavior
# (marko.asplund at kronodoc.fi).
#
# $Id: ssl_client.pl,v 1.7 2002/01/04 08:45:12 aspa Exp $.
#
use strict;
use IO::Socket::SSL;
my ($v_mode, $sock, $buf);
if($ARGV[0] eq "DEBUG") { $IO::Socket::SSL::DEBUG = 1; }
# Check to make sure that we were not accidentally run in the wrong
# directory:
unless (-d "certs") {
if (-d "../certs") {
chdir "..";
} else {
die "Please run this example from the IO::Socket::SSL distribution directory!\n";
}
}
if(!($sock = IO::Socket::SSL->new( PeerAddr => 'localhost',
PeerPort => '9000',
Proto => 'tcp',
SSL_use_cert => 1,
SSL_verify_mode => 0x01,
SSL_passwd_cb => sub { return "opossum" },
))) {
warn "unable to create socket: ", &IO::Socket::SSL::errstr, "\n";
exit(0);
} else {
warn "connect ($sock).\n" if ($IO::Socket::SSL::DEBUG);
}
# check server cert.
my ($subject_name, $issuer_name, $cipher);
if( ref($sock) eq "IO::Socket::SSL") {
$subject_name = $sock->peer_certificate("subject");
$issuer_name = $sock->peer_certificate("issuer");
$cipher = $sock->get_cipher();
}
warn "cipher: $cipher.\n", "server cert:\n",
"\t '$subject_name' \n\t '$issuer_name'.\n\n";
my ($buf) = $sock->getlines;
$sock->close();
print "read: '$buf'.\n";
|