Crypt-NSS
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
lib/Net/NSS/SSL.pm view on Meta::CPAN
=item bind ( $host : string, $port : integer )
Binds an the socket to a network address, ie host + port.
=item listen ( )
=item listen ( $queue_length : integer )
Listens for connections on the socket. The optional argument I<$queue_length> is the maximum length of the queue of
pending connections. Defaults to 10.
=item configure_as_server ( $certificate : Crypt::NSS::Certificate, $private_key : Crypt::NSS::PrivateKey )
Configures a listening socket with the information needed to handshake as a SSL server.
=item accept ( ) : Net::NSS::SSL
=item accept ( $timeout : integer ) : Net::NSS::SSL
Accepts a connection on the socket and returns the new socket used to communicate with the connected client. The
optional argument I<$timeout> specified determined how long the connection setup might take. If ommited C<PR_INTERVAL_NO_TIMEOUT> is used.
This method blocks the calling thread until either a new connection is successfully accepted or an error occurs.
t/lib/Test/Crypt/NSS/TestServer.pm view on Meta::CPAN
# }
# else {
require Crypt::NSS;
Crypt::NSS->import(config_dir => "db", cipher_suite => "US");
my $private_cert = Crypt::NSS::PKCS11->find_cert_by_nickname("127.0.0.1", DB_PASSWORD);
if (!$private_cert) {
print STDERR "Failed to get private cert\n";
exit;
}
my $private_key = Crypt::NSS::PKCS11->find_key_by_any_cert($private_cert, DB_PASSWORD);
if (!$private_key) {
print STDERR "Failed to get private key\n";
exit;
}
Crypt::NSS::SSL->config_server_session_cache({});
my $sock = Net::NSS::SSL->create_socket("tcp");
$sock->set_option(Blocking => 1);
$sock->bind("127.0.0.1", $port);
$sock->listen();
$sock->import_into_ssl_layer();
$sock->configure_as_server($private_cert, $private_key);
my $client = $sock->accept();
$client->set_option(Blocking => 1);
$client->set_option(SSL_SECURITY, SSL_OPTION_ENABLE);
$client->set_option(SSL_HANDSHAKE_AS_SERVER, SSL_OPTION_ENABLE);
$client->set_option(SSL_REQUEST_CERTIFICATE, SSL_OPTION_DISABLE);
$client->set_option(SSL_REQUIRE_CERTIFICATE, SSL_OPTION_DISABLE);
$client->set_pkcs11_pin_arg(DB_PASSWORD);
view all matches for this distributionview release on metacpan - search on metacpan
( run in 1.224 second using v1.00-cache-2.02-grep-82fe00e-cpan-2cc899e4a130 )