$ openssl req -new -x509 -keyout cert.crt -out cert.crt \
> -nodes -sha1 -days 3650
####
Common Name (eg, YOUR name) []:
####
use strict;
use IO::Socket::SSL;
my $cert = '/path/to/cert.crt';
my ($sock, $s);
if(!($sock = IO::Socket::SSL->new( Listen => 5,
LocalAddr => 'localhost',
LocalPort => 9000,
Proto => 'tcp',
Reuse => 1,
SSL_key_file => $cert,
SSL_cert_file => $cert
)) ) {
warn "unable to create socket: ", &IO::Socket::SSL::errstr, "\n";
exit(0);
}
while (1) {
while(($s = $sock->accept())) {
.
.
.
}
}
####
use strict;
use IO::Socket::SSL;
my $client = new IO::Socket::SSL('localhost:9000');
.
.
.