Name
SPVM::IO::Socket::SSL - Sockets for SSL.
Description
This class is highly experimental and not yet implemented completly and not tested well and not yet documented.
IO::Socket::SSL class in SPVM has methods for SSL sockets.
Usage
use IO::Socket::SSL;
# Client
my $client_socket = IO::Socket::SSL->new({
PeerAddr => "www.google.com:443"
});
# Server
my $server_socket = IO::Socket::SSL->new({
Listen => 10,
});
$server_socket->accept;
Super Class
Fields
ssl
has ssl : ro Net::SSLeay;
A Net::SSLeay object.
SSL_version
has SSL_version : string;
SSL_verify_mode
has SSL_verify_mode : int;
SSL_hostname
has SSL_hostname : string;
SSL_cipher_list
has SSL_cipher_list : string;
SSL_ciphersuites
has SSL_ciphersuites : string;
SSL_check_crl
has SSL_check_crl : int;
SSL_crl_file
has SSL_crl_file : string;
SSL_server
has SSL_server : int;
SSL_server_specified
has SSL_server_specified : int;
SSL_alpn_protocols
has SSL_alpn_protocols : string[];
SSL_startHandshake
has SSL_startHandshake : int;
SSL_honor_cipher_order
has SSL_honor_cipher_order : int;
Class Methods
new
static method new : IO::Socket::SSL ($options : object[] = undef);
Instance Methods
option_names
protected method option_names : string[] ();
init
protected method init : void ($options : object[] = undef);
Options:
SSL_version : string
SSL_verify_mode : Int
SSL_hostname : string
SSL_cipher_list : string
SSL_ciphersuites : string
SSL_check_crl : Int
SSL_crl_file : string
SSL_server : Int
SSL_alpn_protocols : string[]
SSL_startHandshake : Int = 1
SSL_honor_cipher_order : Int = 0;
configure
protected method configure : void ();
configure_SSL
protected method configure_SSL : void ();
connect_SSL
method connect_SSL : void ();
accept_SSL
method accept_SSL : void ();
accept
method accept : IO::Socket::SSL ($peer_ref : Sys::Socket::Sockaddr[] = undef);
read
method read : int ($buffer : mutable string, $length : int = -1, $offset : int = 0);
write
method write : int ($buffer : string, $length : int = -1, $offset : int = 0);
close
method close : void ();
stat
method stat : Sys::IO::Stat ();
This method is not allowed in IO::Scoekt::SSL.
Exceptions:
An exception is thrown.
send
method send : int ($buffer : string, $flags : int = 0, $length : int = -1, $offset : int = 0);
This method is not allowed in IO::Scoekt::SSL.
Exceptions:
An exception is thrown.
sendto
method sendto : int ($buffer : string, $flags : int, $to : Sys::Socket::Sockaddr, $length : int = -1, $offset : int = 0);
This method is not allowed in IO::Scoekt::SSL.
Exceptions:
An exception is thrown.
recv
method recv : int ($buffer : mutable string, $length : int = -1, $flags : int = 0, $offset : int = 0);
This method is not allowed in IO::Scoekt::SSL.
Exceptions:
An exception is thrown.
recvfrom
method recvfrom : int ($buffer : mutable string, $length : int, $flags : int, $from_ref : Sys::Socket::Sockaddr[], $offset : int = 0);
This method is not allowed in IO::Scoekt::SSL.
Exceptions:
An exception is thrown.
dump_peer_certificate
method dump_peer_certificate : string ();
Calls Net::SSLeay#dump_peer_certificate method given the value of "ssl" field, and returns its return value.
Exceptions:
Exceptions thrown by Net::SSLeay#dump_peer_certificate method could be thrown.
alpn_selected
method alpn_selected : string ();
Calls Net::SSLeay#get0_alpn_selected method given appropriate arguments, converts the value of output argument to a string of appropriate length, and retunrs it.
get_sslversion
method get_sslversion : string ();
Returns the same output of Perl's IO::Socket::SSL method.
Exceptions:
If the version number is unknown, an exception is thrown.
get_sslversion_int
method get_sslversion_int : int ();
Calls Net::SSLeay#version method given the value of "ssl" field, and returns its return value.
get_cipher
method get_cipher : string ();
Calls Net::SSLeay#get_cipher method given the value of "ssl" field, and returns its return value.
Exceptions:
Exceptions thrown by Net::SSLeay#get_cipher method could be thrown.
get_servername
method get_servername : string ();
Calls Net::SSLeay#get_servername method given the value of "ssl" field, the value of TLSEXT_NAMETYPE_host_name
, and returns its return value.
Exceptions:
Exceptions thrown by Net::SSLeay#get_servername method could be thrown.
peer_certificate
method peer_certificate : Net::SSLeay::X509 ();
Calls Net::SSLeay#get1_peer_certificate method given the value of "ssl" field, and returns its return value.
Exceptions:
Exceptions thrown by Net::SSLeay#get1_peer_certificate method could be thrown.
peer_certificates
method peer_certificates : Net::SSLeay::X509[];
Returns the same output of Perl's IO::Socket::SSL method.
sock_certificate
method sock_certificate : Net::SSLeay::X509 ();
Calls Net::SSLeay#get_certificate method given the value of "ssl" field, and returns its return value.
Exceptions:
Exceptions thrown by Net::SSLeay#get_certificate method could be thrown.
get_fingerprint_bin
method get_fingerprint_bin : string ($algo : string = undef, $cert : Net::SSLeay::X509 = undef, $key_only : int = 0);
Returns the same output of Perl's IO::Socket::SSL method.
get_fingerprint
method get_fingerprint : string ($algo : string = undef, $cert : Net::SSLeay::X509 = undef, $key_only : int = 0);
Returns the same output of Perl's IO::Socket::SSL method.
FAQ
How to create a Net::SSLeay::X509 object for SSL_ca option from the return value of Mozilla::CA#SSL_ca method.
use Mozilla::CA;
use Net::SSLeay::BIO;
use Net::SSLeay::PEM;
my $ca = Mozilla::CA->SSL_ca;
my $bio = Net::SSLeay::BIO->new;
$bio->write($ca);
my $x509 = Net::SSLeay::PEM->read_bio_X509($bio);
my $SSL_ca = $x509;
See Also
Repository
SPVM::IO::Socket::SSL - Github
Author
Yuki Kimoto kimoto.yuki@gmail.com
Copyright & License
Copyright (c) 2024 Yuki Kimoto
MIT License
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 170:
Unterminated C<...> sequence