%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/self/root/usr/local/share/man/man3/
Upload File :
Create Path :
Current File : //proc/self/root/usr/local/share/man/man3/IO::Socket::SSL.3pm

.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.13)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings.  \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
.    ds -- \(*W-
.    ds PI pi
.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
.    ds L" ""
.    ds R" ""
.    ds C` ""
.    ds C' ""
'br\}
.el\{\
.    ds -- \|\(em\|
.    ds PI \(*p
.    ds L" ``
.    ds R" ''
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD.  Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.ie \nF \{\
.    de IX
.    tm Index:\\$1\t\\n%\t"\\$2"
..
.    nr % 0
.    rr F
.\}
.el \{\
.    de IX
..
.\}
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
.    \" fudge factors for nroff and troff
.if n \{\
.    ds #H 0
.    ds #V .8m
.    ds #F .3m
.    ds #[ \f1
.    ds #] \fP
.\}
.if t \{\
.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
.    ds #V .6m
.    ds #F 0
.    ds #[ \&
.    ds #] \&
.\}
.    \" simple accents for nroff and troff
.if n \{\
.    ds ' \&
.    ds ` \&
.    ds ^ \&
.    ds , \&
.    ds ~ ~
.    ds /
.\}
.if t \{\
.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
.    \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
.    \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
.    \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
.    ds : e
.    ds 8 ss
.    ds o a
.    ds d- d\h'-1'\(ga
.    ds D- D\h'-1'\(hy
.    ds th \o'bp'
.    ds Th \o'LP'
.    ds ae ae
.    ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "IO::Socket::SSL 3"
.TH IO::Socket::SSL 3 "2013-07-22" "perl v5.10.1" "User Contributed Perl Documentation"
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
IO::Socket::SSL \-\- SSL sockets with IO::Socket interface
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 2
\&    use strict;
\&    use IO::Socket::SSL;
\&
\&    # simple HTTP client \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
\&    my $sock = IO::Socket::SSL\->new(
\&        # where to connect
\&        PeerHost => "www.example.com",
\&        PeerPort => "https",
\&
\&        # certificate verification
\&        SSL_verify_mode => SSL_VERIFY_PEER,
\&        SSL_ca_path => \*(Aq/etc/ssl/certs\*(Aq, # typical CA path on Linux
\&        # on OpenBSD instead: SSL_ca_file => \*(Aq/etc/ssl/cert.pem\*(Aq
\&
\&        # easy hostname verification 
\&        SSL_verifycn_name => \*(Aqfoo.bar\*(Aq, # defaults to PeerHost
\&        SSL_verifycn_schema => \*(Aqhttp\*(Aq,
\&
\&        # SNI support
\&        SSL_hostname => \*(Aqfoo.bar\*(Aq, # defaults to PeerHost
\&
\&    ) or die "failed connect or ssl handshake: $!,$SSL_ERROR";
\&
\&    # send and receive over SSL connection
\&    print $client "GET / HTTP/1.0\er\en\er\en";
\&    print <$client>;
\&
\&    # simple server \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
\&    my $server = IO::Socket::SSL\->new(
\&        # where to listen
\&        LocalAddr => \*(Aq127.0.0.1\*(Aq,
\&        LocalPort => 8080,
\&        Listen => 10,
\&
\&        # which certificate to offer
\&        # with SNI support there can be different certificates per hostname
\&        SSL_cert_file => \*(Aqcert.pem\*(Aq,
\&        SSL_key_file => \*(Aqkey.pem\*(Aq,
\&    ) or die "failed to listen: $!";
\&
\&    # accept client
\&    my $client = $server\->accept or die 
\&        "failed to accept or ssl handshake: $!,$SSL_ERROR";
\&
\&    # Upgrade existing socket to SSL \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
\&    my $sock = IO::Socket::INET\->new(\*(Aqimap.example.com:imap\*(Aq);
\&    # ... receive greeting, send STARTTLS, receive ok ...
\&    IO::Socket::SSL\->start_SSL($sock,
\&        SSL_verify_mode => SSL_VERIFY_PEER,
\&        SSL_ca_path => \*(Aq/etc/ssl/certs\*(Aq,
\&        ...
\&    ) or die "failed to upgrade to SSL: $SSL_ERROR";
\&
\&    # manual name verification, could also be done in start_SSL with
\&    # SSL_verifycn_name etc
\&    $client\->verify_hostname( \*(Aqimap.example.com\*(Aq,\*(Aqimap\*(Aq )
\&        or die "hostname verification failed";
\&
\&    # all data are now SSL encrypted
\&    print $sock ....
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
This module provides an interface to \s-1SSL\s0 sockets, similar to other IO::Socket
modules. Because of that, it can be used to make existing programs using
IO::Socket::INET or similar modules to provide \s-1SSL\s0 encryption without much
effort.
IO::Socket::SSL supports all the extra features that one needs to write a
full-featured \s-1SSL\s0 client or server application: multiple \s-1SSL\s0 contexts, cipher
selection, certificate verification, Server Name Indication (\s-1SNI\s0), Next
Protocol Negotiation (\s-1NPN\s0), \s-1SSL\s0 version selection and more.
.PP
If you have never used \s-1SSL\s0 before, you should read the appendix labelled 'Using \s-1SSL\s0'
before attempting to use this module.
.PP
If you are trying to use it with threads see the \s-1BUGS\s0 section.
.SH "METHODS"
.IX Header "METHODS"
IO::Socket::SSL inherits from another IO::Socket module.
The choice of the super class depends on the installed modules:
.IP "\(bu" 4
If IO::Socket::IP with at least version 0.20 is installed it will use this
module as super class, transparently providing IPv6 and IPv4 support.
.IP "\(bu" 4
If IO::Socket::INET6 is installed it will use this module as super class,
transparently providing IPv6 and IPv4 support.
.IP "\(bu" 4
Otherwise it will fall back to IO::Socket::INET, which is a perl core module.
With IO::Socket::INET you only get IPv4 support.
.PP
Please be aware, that with the IPv6 capable super classes, it will lookup first
for the IPv6 address of a given hostname. If the resolver provides an IPv6
address, but the host cannot be reached by IPv6, there will be no automatic 
fallback to IPv4.
To avoid these problems you can either force IPv4 by specifying and \s-1AF_INET\s0
as \f(CW\*(C`Domain\*(C'\fR of the socket or globally enforce IPv4 by loading IO::Socket::SSL
with the option 'inet4'.
.PP
IO::Socket::SSL will provide all of the methods of its super class, but
sometimes it will override them to match the behavior expected from \s-1SSL\s0 or to
provide additional arguments.
.PP
The new or changed methods are described below, but please read also the
section about \s-1SSL\s0 specific error handling.
.IP "\fBnew(...)\fR" 4
.IX Item "new(...)"
Creates a new IO::Socket::SSL object.  You may use all the friendly options
that came bundled with IO::Socket::INET, plus (optionally) the ones that follow:
.RS 4
.IP "SSL_hostname" 2
.IX Item "SSL_hostname"
This can be given to specify the hostname used for \s-1SNI\s0, which is needed if you
have multiple \s-1SSL\s0 hostnames on the same \s-1IP\s0 address. If not given it will try to
determine hostname from PeerAddr, which will fail if only \s-1IP\s0 was given or if
this argument is used within start_SSL.
.Sp
If you want to disable \s-1SNI\s0 set this argument to ''.
.Sp
Currently only supported for the client side and will be ignored for the server
side.
.Sp
See section \*(L"\s-1SNI\s0 Support\*(R" for details of \s-1SNI\s0 the support.
.IP "SSL_version" 2
.IX Item "SSL_version"
Sets the version of the \s-1SSL\s0 protocol used to transmit data. 'SSLv23' auto-negotiates 
between SSLv2 and SSLv3, while 'SSLv2', 'SSLv3' or 'TLSv1' restrict the protocol
to the specified version. All values are case-insensitive.
.Sp
You can limit to set of supported protocols by adding !version separated by ':'.
.Sp
The default SSL_version is 'SSLv23:!SSLv2' which means, that SSLv2, SSLv3 and TLSv1 
are supported for initial protocol handshakes, but SSLv2 will not be accepted, leaving 
only SSLv3 and TLSv1. You can also use !TLSv11 and !TLSv12 to disable \s-1TLS\s0 versions
1.1 and 1.2 while allowing \s-1TLS\s0 version 1.0.
.Sp
Setting the version instead to 'TLSv1' will probably break interaction with lots of
clients which start with SSLv2 and then upgrade to TLSv1. On the other side some
clients just close the connection when they receive a \s-1TLS\s0 version 1.1 request. In this 
case setting the version to 'SSLv23:!SSLv2:!TLSv11:!TLSv12' might help.
.IP "SSL_cipher_list" 2
.IX Item "SSL_cipher_list"
If this option is set the cipher list for the connection will be set to the
given value, e.g. something like '\s-1ALL:\s0!LOW:!EXP:!ADH'. Look into the OpenSSL
documentation (<http://www.openssl.org/docs/apps/ciphers.html#CIPHER_STRINGS>)
for more details.
.Sp
If this option is not set '\s-1ALL:\s0!LOW' will be used.
To use OpenSSL builtin default (whatever this is) set it to ''.
.IP "SSL_honor_cipher_order" 2
.IX Item "SSL_honor_cipher_order"
If this option is true the cipher order the server specified is used instead
of the order proposed by the client. To mitigate \s-1BEAST\s0 attack you might use
something like
.Sp
.Vb 2
\&  SSL_honor_cipher_order => 1,
\&  SSL_cipher_list => \*(AqRC4\-SHA:ALL:!ADH:!LOW\*(Aq,
.Ve
.IP "SSL_use_cert" 2
.IX Item "SSL_use_cert"
If this is true, it forces IO::Socket::SSL to use a certificate and key, even if
you are setting up an \s-1SSL\s0 client.  If this is set to 0 (the default), then you will
only need a certificate and key if you are setting up a server.
.Sp
SSL_use_cert will implicitly be set if SSL_server is set.
For convenience it is also set if it was not given but a cert was given for use
(SSL_cert_file or similar).
.IP "SSL_server" 2
.IX Item "SSL_server"
Set this option to a true value, if the socket should be used as a server.
If this is not explicitly set it is assumed, if the Listen parameter is given
when creating the socket.
.IP "SSL_cert_file | SSL_cert | SSL_key_file | SSL_key" 2
.IX Item "SSL_cert_file | SSL_cert | SSL_key_file | SSL_key"
If you create a server you usually need to specify a server certificate which
should be verified by the client. Same is true for client certificates, which
should be verified by the server.
The certificate can be given as a file in \s-1PEM\s0 format with SSL_cert_file or 
as an internal representation of a X509* object with SSL_cert.
.Sp
For each certificate a key is need, which can either be given as a file in \s-1PEM\s0
format with SSL_key_file or as an internal representation of a EVP_PKEY* object
with SSL_key.
.Sp
If your \s-1SSL\s0 server should be able to use different certificates on the same \s-1IP\s0
address, depending on the name given by \s-1SNI\s0, you can use a hash reference
instead of a file with \f(CW\*(C`<hostname =\*(C'\fR cert_file>>.
.Sp
In case certs and keys are needed but not given it might fall back to builtin
defaults, see \*(L"Defaults for Cert, Key and \s-1CA\s0\*(R".
.Sp
Examples:
.Sp
.Vb 2
\& SSL_cert_file => \*(Aqmycert.pem\*(Aq,
\& SSL_key_file => \*(Aqmykey.pem\*(Aq,
\&
\& SSL_cert_file => {
\&    "foo.example.org" => \*(Aqfoo\-cert.pem\*(Aq,
\&    "bar.example.org" => \*(Aqbar\-cert.pem\*(Aq,
\&    # used when nothing matches or client does not support SNI
\&    \*(Aq\*(Aq => \*(Aqdefault\-cert.pem\*(Aq, 
\& }
\& SSL_key_file => {
\&    "foo.example.org" => \*(Aqfoo\-key.pem\*(Aq,
\&    "bar.example.org" => \*(Aqbar\-key.pem\*(Aq,
\&    # used when nothing matches or client does not support SNI
\&    \*(Aq\*(Aq => \*(Aqdefault\-key.pem\*(Aq, 
\& }
.Ve
.IP "SSL_dh_file" 2
.IX Item "SSL_dh_file"
If you want Diffie-Hellman key exchange you need to supply a suitable file here
or use the SSL_dh parameter. See dhparam command in openssl for more information.
.IP "SSL_dh" 2
.IX Item "SSL_dh"
Like SSL_dh_file, but instead of giving a file you use a preloaded or generated DH*.
.IP "SSL_passwd_cb" 2
.IX Item "SSL_passwd_cb"
If your private key is encrypted, you might not want the default password prompt from
Net::SSLeay.  This option takes a reference to a subroutine that should return the
password required to decrypt your private key.
.IP "SSL_ca_file | SSL_ca_path" 2
.IX Item "SSL_ca_file | SSL_ca_path"
Usually you want to verify that the peer certificate has been signed by a
trusted certificate authority. In this case you should use this option to
specify the file (SSL_ca_file) or directory (SSL_ca_path) containing the
certificate(s) of the trusted certificate authorities.
If both SSL_ca_file and SSL_ca_path are undefined and not builtin defaults (see
\&\*(L"Defaults for Cert, Key and \s-1CA\s0\*(R".) can be used, it will try to use the system
defaults used built into the OpenSSL library.
If you really don't want to set a \s-1CA\s0 set this key to \f(CW\*(Aq\*(Aq\fR.
.IP "SSL_verify_mode" 2
.IX Item "SSL_verify_mode"
This option sets the verification mode for the peer certificate.  
You may combine \s-1SSL_VERIFY_PEER\s0 (verify_peer), \s-1SSL_VERIFY_FAIL_IF_NO_PEER_CERT\s0
(fail verification if no peer certificate exists; ignored for clients),
\&\s-1SSL_VERIFY_CLIENT_ONCE\s0 (verify client once; ignored for clients).
See OpenSSL man page for SSL_CTX_set_verify for more information.
.Sp
The default is \s-1SSL_VERIFY_NONE\s0 for server  (e.g. no check for client
certificate) and \s-1SSL_VERIFY_PEER\s0 for client (check server certificate).
.IP "SSL_verify_callback" 2
.IX Item "SSL_verify_callback"
If you want to verify certificates yourself, you can pass a sub reference along
with this parameter to do so.  When the callback is called, it will be passed:
.RS 2
.IP "1. a true/false value that indicates what OpenSSL thinks of the certificate," 4
.IX Item "1. a true/false value that indicates what OpenSSL thinks of the certificate,"
.PD 0
.IP "2. a C\-style memory address of the certificate store," 4
.IX Item "2. a C-style memory address of the certificate store,"
.IP "3. a string containing the certificate's issuer attributes and owner attributes, and" 4
.IX Item "3. a string containing the certificate's issuer attributes and owner attributes, and"
.IP "4. a string containing any errors encountered (0 if no errors)." 4
.IX Item "4. a string containing any errors encountered (0 if no errors)."
.IP "5. a C\-style memory address of the peer's own certificate (convertible to \s-1PEM\s0 form with \fINet::SSLeay::PEM_get_string_X509()\fR)." 4
.IX Item "5. a C-style memory address of the peer's own certificate (convertible to PEM form with Net::SSLeay::PEM_get_string_X509())."
.RE
.RS 2
.PD
.Sp
The function should return 1 or 0, depending on whether it thinks the certificate
is valid or invalid.  The default is to let OpenSSL do all of the busy work.
.Sp
The callback will be called for each element in the certificate chain.
.Sp
See the OpenSSL documentation for SSL_CTX_set_verify for more information.
.RE
.IP "SSL_verifycn_scheme" 2
.IX Item "SSL_verifycn_scheme"
Set the scheme used to automatically verify the hostname of the peer.
See the information about the verification schemes in \fBverify_hostname\fR.
.Sp
The default is undef, e.g. to not automatically verify the hostname.
If no verification is done the other \fBSSL_verifycn_*\fR options have
no effect, but you might still do manual verification by calling
\&\fBverify_hostname\fR.
.IP "SSL_verifycn_name" 2
.IX Item "SSL_verifycn_name"
Set the name which is used in verification of hostname. If SSL_verifycn_scheme
is set and no SSL_verifycn_name is given it will try to use the PeerHost and
PeerAddr settings and fail if no name can be determined.
.Sp
Using PeerHost or PeerAddr works only if you create the connection directly
with \f(CW\*(C`IO::Socket::SSL\->new\*(C'\fR, if an IO::Socket::INET object is upgraded
with \fBstart_SSL\fR the name has to be given in \fBSSL_verifycn_name\fR.
.IP "SSL_check_crl" 2
.IX Item "SSL_check_crl"
If you want to verify that the peer certificate has not been revoked
by the signing authority, set this value to true. OpenSSL will search
for the \s-1CRL\s0 in your SSL_ca_path, or use the file specified by
SSL_crl_file.  See the Net::SSLeay documentation for more details.
Note that this functionality appears to be broken with OpenSSL <
v0.9.7b, so its use with lower versions will result in an error.
.IP "SSL_crl_file" 2
.IX Item "SSL_crl_file"
If you want to specify the \s-1CRL\s0 file to be used, set this value to the
pathname to be used.  This must be used in addition to setting
SSL_check_crl.
.IP "SSL_reuse_ctx" 2
.IX Item "SSL_reuse_ctx"
If you have already set the above options (SSL_version through SSL_check_crl;
this does not include SSL_cipher_list yet) for a previous instance of
IO::Socket::SSL, then you can reuse the \s-1SSL\s0 context of that instance by passing
it as the value for the SSL_reuse_ctx parameter.  You may also create a
new instance of the IO::Socket::SSL::SSL_Context class, using any context options
that you desire without specifying connection options, and pass that here instead.
.Sp
If you use this option, all other context-related options that you pass
in the same call to \fInew()\fR will be ignored unless the context supplied was invalid.
Note that, contrary to versions of IO::Socket::SSL below v0.90, a global \s-1SSL\s0 context
will not be implicitly used unless you use the \fIset_default_context()\fR function.
.IP "SSL_create_ctx_callback" 2
.IX Item "SSL_create_ctx_callback"
With this callback you can make individual settings to the context after it
got created and the default setup was done.
The callback will be called with the \s-1CTX\s0 object from Net::SSLeay as the single
argument.
.Sp
Example for limiting the server session cache size:
.Sp
.Vb 4
\&  SSL_create_ctx_callback => sub { 
\&      my $ctx = shift;
\&          Net::SSLeay::CTX_sess_set_cache_size($ctx,128);
\&  }
.Ve
.IP "SSL_session_cache_size" 2
.IX Item "SSL_session_cache_size"
If you make repeated connections to the same host/port and the \s-1SSL\s0 renegotiation time
is an issue, you can turn on client-side session caching with this option by specifying a
positive cache size.  For successive connections, pass the SSL_reuse_ctx option to
the \fInew()\fR calls (or use \fIset_default_context()\fR) to make use of the cached sessions.
The session cache size refers to the number of unique host/port pairs that can be
stored at one time; the oldest sessions in the cache will be removed if new ones are
added.
.Sp
This option does not effect the session cache a server has for it's clients, e.g. it
does not affect \s-1SSL\s0 objects with SSL_server set.
.IP "SSL_session_cache" 2
.IX Item "SSL_session_cache"
Specifies session cache object which should be used instead of creating a new.
Overrules SSL_session_cache_size.
This option is useful if you want to reuse the cache, but not the rest of
the context.
.Sp
A session cache object can be created using
\&\f(CW\*(C`IO::Socket::SSL::Session_Cache\->new( cachesize )\*(C'\fR.
.Sp
Use \fIset_default_session_cache()\fR to set a global cache object.
.IP "SSL_session_id_context" 2
.IX Item "SSL_session_id_context"
This gives an id for the servers session cache. It's necessary if you want
clients to connect with a client certificate. If not given but SSL_verify_mode
specifies the need for client certificate a context unique id will be picked.
.IP "SSL_error_trap" 2
.IX Item "SSL_error_trap"
When using the \fIaccept()\fR or \fIconnect()\fR methods, it may be the case that the
actual socket connection works but the \s-1SSL\s0 negotiation fails, as in the case of
an \s-1HTTP\s0 client connecting to an \s-1HTTPS\s0 server.  Passing a subroutine ref attached
to this parameter allows you to gain control of the orphaned socket instead of having it
be closed forcibly.	 The subroutine, if called, will be passed two parameters:
a reference to the socket on which the \s-1SSL\s0 negotiation failed and the full
text of the error message.
.IP "SSL_npn_protocols" 2
.IX Item "SSL_npn_protocols"
If used on the server side it specifies list of protocols advertised by \s-1SSL\s0
server as an array ref, e.g. ['spdy/2','http1.1']. 
On the client side it specifies the protocols offered by the client for \s-1NPN\s0
as an array ref.
See also method next_proto_negotiated.
.Sp
Next Protocol Negotioation (\s-1NPN\s0) is available with Net::SSLeay 1.46+ and openssl\-1.0.1+.
To check support you might call \f(CW\*(C`IO::Socket::SSL\-\*(C'\fR\fIcan_npn()\fR>.
If you use this option with an unsupported Net::SSLeay/OpenSSL it will 
throw an error.
.RE
.RS 4
.RE
.IP "\fBclose(...)\fR" 4
.IX Item "close(...)"
There are a number of nasty traps that lie in wait if you are not careful about using
\&\fIclose()\fR.  The first of these will bite you if you have been using \fIshutdown()\fR on your
sockets.  Since the \s-1SSL\s0 protocol mandates that a \s-1SSL\s0 \*(L"close notify\*(R" message be
sent before the socket is closed, a \fIshutdown()\fR that closes the socket's write channel
will cause the \fIclose()\fR call to hang.  For a similar reason, if you try to close a
copy of a socket (as in a forking server) you will affect the original socket as well.
To get around these problems, call close with an object-oriented syntax
(e.g. \f(CW$socket\fR\->close(SSL_no_shutdown => 1))
and one or more of the following parameters:
.RS 4
.IP "SSL_no_shutdown" 2
.IX Item "SSL_no_shutdown"
If set to a true value, this option will make \fIclose()\fR not use the \fISSL_shutdown()\fR call
on the socket in question so that the close operation can complete without problems
if you have used \fIshutdown()\fR or are working on a copy of a socket.
.IP "SSL_fast_shutdown" 2
.IX Item "SSL_fast_shutdown"
If set to true only a unidirectional shutdown will be done, e.g. only the
close_notify (see \fISSL_shutdown\fR\|(3)) will be called. Otherwise a bidirectional
shutdown will be done. If used within \fIclose()\fR it defaults to true, if used
within \fIstop_SSL()\fR it defaults to false.
.IP "SSL_ctx_free" 2
.IX Item "SSL_ctx_free"
If you want to make sure that the \s-1SSL\s0 context of the socket is destroyed when
you close it, set this option to a true value.
.RE
.RS 4
.RE
.IP "\fBpeek(...)\fR" 4
.IX Item "peek(...)"
This function has exactly the same syntax as \fIsysread()\fR, and performs nearly the same
task (reading data from the socket) but will not advance the read position so
that successive calls to \fIpeek()\fR with the same arguments will return the same results.
This function requires OpenSSL 0.9.6a or later to work.
.IP "\fB\f(BIpending()\fB\fR" 4
.IX Item "pending()"
This function will let you know how many bytes of data are immediately ready for reading
from the socket.  This is especially handy if you are doing reads on a blocking socket
or just want to know if new data has been sent over the socket.
.IP "\fB\f(BIget_cipher()\fB\fR" 4
.IX Item "get_cipher()"
Returns the string form of the cipher that the IO::Socket::SSL object is using.
.IP "\fB\f(BIdump_peer_certificate()\fB\fR" 4
.IX Item "dump_peer_certificate()"
Returns a parsable string with select fields from the peer \s-1SSL\s0 certificate.	 This
method directly returns the result of the \fIdump_peer_certificate()\fR method of Net::SSLeay.
.IP "\fBpeer_certificate($field)\fR" 4
.IX Item "peer_certificate($field)"
If a peer certificate exists, this function can retrieve values from it.
If no field is given the internal representation of certificate from Net::SSLeay is
returned.
The following fields can be queried:
.RS 4
.IP "authority (alias issuer)" 8
.IX Item "authority (alias issuer)"
The certificate authority which signed the certificate.
.IP "owner (alias subject)" 8
.IX Item "owner (alias subject)"
The owner of the certificate.
.IP "commonName (alias cn) \- only for Net::SSLeay version >=1.30" 8
.IX Item "commonName (alias cn) - only for Net::SSLeay version >=1.30"
The common name, usually the server name for \s-1SSL\s0 certificates.
.IP "subjectAltNames \- only for Net::SSLeay version >=1.33" 8
.IX Item "subjectAltNames - only for Net::SSLeay version >=1.33"
Alternative names for the subject, usually different names for the same
server, like example.org, example.com, *.example.com.
.Sp
It returns a list of (typ,value) with typ \s-1GEN_DNS\s0, \s-1GEN_IPADD\s0 etc (these
constants are exported from IO::Socket::SSL).
See Net::SSLeay::X509_get_subjectAltNames.
.RE
.RS 4
.RE
.IP "\fBget_servername\fR" 4
.IX Item "get_servername"
This gives the name requested by the client if Server Name Indication
(\s-1SNI\s0) was used.
.IP "\fBverify_hostname($hostname,$scheme)\fR" 4
.IX Item "verify_hostname($hostname,$scheme)"
This verifies the given hostname against the peer certificate using the
given scheme. Hostname is usually what you specify within the PeerAddr.
.Sp
Verification of hostname against a certificate is different between various
applications and RFCs. Some scheme allow wildcards for hostnames, some only
in subjectAltNames, and even their different wildcard schemes are possible.
.Sp
To ease the verification the following schemes are predefined:
.RS 4
.IP "ldap (rfc4513), pop3,imap,acap (rfc2995), nntp (rfc4642)" 8
.IX Item "ldap (rfc4513), pop3,imap,acap (rfc2995), nntp (rfc4642)"
Simple wildcards in subjectAltNames are possible, e.g. *.example.org matches
www.example.org but not lala.www.example.org. If nothing from subjectAltNames
match it checks against the common name, but there are no wildcards allowed.
.IP "http (rfc2818), alias is www" 8
.IX Item "http (rfc2818), alias is www"
Extended wildcards in subjectAltNames and common name are possible, e.g. 
*.example.org or even www*.example.org. The common
name will be only checked if no names are given in subjectAltNames.
.IP "smtp (rfc3207)" 8
.IX Item "smtp (rfc3207)"
This \s-1RFC\s0 doesn't say much useful about the verification so it just assumes
that subjectAltNames are possible, but no wildcards are possible anywhere.
.IP "none" 8
.IX Item "none"
No verification will be done.
Actually is does not make any sense to call verify_hostname in this case.
.RE
.RS 4
.Sp
The scheme can be given either by specifying the name for one of the above predefined
schemes, or by using a hash which can have the following keys and values:
.IP "check_cn:  0|'always'|'when_only'" 8
.IX Item "check_cn:  0|'always'|'when_only'"
Determines if the common name gets checked. If 'always' it will always be checked
(like in ldap), if 'when_only' it will only be checked if no names are given in
subjectAltNames (like in http), for any other values the common name will not be checked.
.IP "wildcards_in_alt: 0|'leftmost'|'anywhere'" 8
.IX Item "wildcards_in_alt: 0|'leftmost'|'anywhere'"
Determines if and where wildcards in subjectAltNames are possible. If 'leftmost'
only cases like *.example.org will be possible (like in ldap), for 'anywhere'
www*.example.org is possible too (like http), dangerous things like but www.*.org
or even '*' will not be allowed.
.IP "wildcards_in_cn: 0|'leftmost'|'anywhere'" 8
.IX Item "wildcards_in_cn: 0|'leftmost'|'anywhere'"
Similar to wildcards_in_alt, but checks the common name. There is no predefined
scheme which allows wildcards in common names.
.IP "callback: \e&coderef" 8
.IX Item "callback: &coderef"
If you give a subroutine for verification it will be called with the arguments
($hostname,$commonName,@subjectAltNames), where hostname is the name given for
verification, commonName is the result from peer_certificate('cn') and
subjectAltNames is the result from peer_certificate('subjectAltNames').
.Sp
All other arguments for the verification scheme will be ignored in this case.
.RE
.RS 4
.RE
.IP "\fB\f(BInext_proto_negotiated()\fB\fR" 4
.IX Item "next_proto_negotiated()"
This method returns the name of negotiated protocol \- e.g. 'http/1.1'. It works
for both client and server side of \s-1SSL\s0 connection.
.Sp
\&\s-1NPN\s0 support is available with Net::SSLeay 1.46+ and openssl\-1.0.1+.
To check support you might call \f(CW\*(C`IO::Socket::SSL\-\*(C'\fR\fIcan_npn()\fR>.
.IP "\fB\f(BIerrstr()\fB\fR" 4
.IX Item "errstr()"
Returns the last error (in string form) that occurred.	If you do not have a real
object to perform this method on, call \fIIO::Socket::SSL::errstr()\fR instead.
.Sp
For read and write errors on non-blocking sockets, this method may include the string
\&\f(CW\*(C`SSL wants a read first!\*(C'\fR or \f(CW\*(C`SSL wants a write first!\*(C'\fR meaning that the other side
is expecting to read from or write to the socket and wants to be satisfied before you
get to do anything. But with version 0.98 you are better comparing the global exported
variable \f(CW$SSL_ERROR\fR against the exported symbols \s-1SSL_WANT_READ\s0 and \s-1SSL_WANT_WRITE\s0.
.IP "\fB\f(BIopened()\fB\fR" 4
.IX Item "opened()"
This returns false if the socket could not be opened, 1 if the socket could be opened
and the \s-1SSL\s0 handshake was successful done and \-1 if the underlying IO::Handle is open,
but the \s-1SSL\s0 handshake failed.
.IP "\fBIO::Socket::SSL\->start_SSL($socket, ... )\fR" 4
.IX Item "IO::Socket::SSL->start_SSL($socket, ... )"
This will convert a glob reference or a socket that you provide to an IO::Socket::SSL
object.	 You may also pass parameters to specify context or connection options as with
a call to \fInew()\fR.  If you are using this function on an \fIaccept()\fRed socket, you must
set the parameter \*(L"SSL_server\*(R" to 1, i.e. IO::Socket::SSL\->start_SSL($socket, SSL_server => 1).
If you have a class that inherits from IO::Socket::SSL and you want the \f(CW$socket\fR to be blessed
into your own class instead, use MyClass\->start_SSL($socket) to achieve the desired effect.
.Sp
Note that if \fIstart_SSL()\fR fails in \s-1SSL\s0 negotiation, \f(CW$socket\fR will remain blessed in its
original class.	 For non-blocking sockets you better just upgrade the socket to
IO::Socket::SSL and call accept_SSL or connect_SSL and the upgraded object. To
just upgrade the socket set \fBSSL_startHandshake\fR explicitly to 0. If you call start_SSL
w/o this parameter it will revert to blocking behavior for accept_SSL and connect_SSL.
.Sp
If given the parameter \*(L"Timeout\*(R" it will stop if after the timeout no \s-1SSL\s0 connection
was established. This parameter is only used for blocking sockets, if it is not given the
default Timeout from the underlying IO::Socket will be used.
.IP "\fBstop_SSL(...)\fR" 4
.IX Item "stop_SSL(...)"
This is the opposite of \fIstart_SSL()\fR, e.g. it will shutdown the \s-1SSL\s0 connection
and return to the class before \fIstart_SSL()\fR. It gets the same arguments as \fIclose()\fR,
in fact \fIclose()\fR calls \fIstop_SSL()\fR (but without downgrading the class).
.Sp
Will return true if it succeeded and undef if failed. This might be the case for
non-blocking sockets. In this case $! is set to \s-1EAGAIN\s0 and the ssl error to
\&\s-1SSL_WANT_READ\s0 or \s-1SSL_WANT_WRITE\s0. In this case the call should be retried again with
the same arguments once the socket is ready is until it succeeds.
.IP "\fBIO::Socket::SSL\->new_from_fd($fd, ...)\fR" 4
.IX Item "IO::Socket::SSL->new_from_fd($fd, ...)"
This will convert a socket identified via a file descriptor into an \s-1SSL\s0 socket.
Note that the argument list does not include a \*(L"\s-1MODE\s0\*(R" argument; if you supply one,
it will be thoughtfully ignored (for compatibility with IO::Socket::INET).	Instead,
a mode of '+<' is assumed, and the file descriptor passed must be able to handle such
I/O because the initial \s-1SSL\s0 handshake requires bidirectional communication.
.IP "\fBIO::Socket::SSL::set_default_context(...)\fR" 4
.IX Item "IO::Socket::SSL::set_default_context(...)"
You may use this to make IO::Socket::SSL automatically re-use a given context (unless
specifically overridden in a call to \fInew()\fR).  It accepts one argument, which should
be either an IO::Socket::SSL object or an IO::Socket::SSL::SSL_Context object.	See
the SSL_reuse_ctx option of \fInew()\fR for more details.	 Note that this sets the default
context globally, so use with caution (esp. in mod_perl scripts).
.IP "\fBIO::Socket::SSL::set_default_session_cache(...)\fR" 4
.IX Item "IO::Socket::SSL::set_default_session_cache(...)"
You may use this to make IO::Socket::SSL automatically re-use a given session cache
(unless specifically overridden in a call to \fInew()\fR).  It accepts one argument, which should
be an IO::Socket::SSL::Session_Cache object or similar (e.g something which implements
get_session and add_session like IO::Socket::SSL::Session_Cache does).
See the SSL_session_cache option of \fInew()\fR for more details.	 Note that this sets the default
cache globally, so use with caution.
.IP "\fBIO::Socket::SSL::set_defaults(%args)\fR" 4
.IX Item "IO::Socket::SSL::set_defaults(%args)"
With this function one can set defaults for all SSL_* parameter used for creation of
the context, like the SSL_verify* parameter.
.RS 4
.IP "mode \- set default SSL_verify_mode" 8
.IX Item "mode - set default SSL_verify_mode"
.PD 0
.IP "callback \- set default SSL_verify_callback" 8
.IX Item "callback - set default SSL_verify_callback"
.IP "scheme \- set default SSL_verifycn_scheme" 8
.IX Item "scheme - set default SSL_verifycn_scheme"
.IP "name \- set default SSL_verifycn_name" 8
.IX Item "name - set default SSL_verifycn_name"
.PD
If not given and scheme is hash reference with key callback it will be set to 'unknown'
.RE
.RS 4
.RE
.IP "\fBIO::Socket::SSL::set_client_defaults(%args)\fR" 4
.IX Item "IO::Socket::SSL::set_client_defaults(%args)"
Similar to \f(CW\*(C`set_defaults\*(C'\fR, but only sets the defaults for client mode.
.IP "\fBIO::Socket::SSL::set_server_defaults(%args)\fR" 4
.IX Item "IO::Socket::SSL::set_server_defaults(%args)"
Similar to \f(CW\*(C`set_defaults\*(C'\fR, but only sets the defaults for server mode.
.PP
The following methods are unsupported (not to mention futile!) and IO::Socket::SSL
will emit a large \s-1\fICROAK\s0()\fR if you are silly enough to use them:
.IP "truncate" 4
.IX Item "truncate"
.PD 0
.IP "stat" 4
.IX Item "stat"
.IP "ungetc" 4
.IX Item "ungetc"
.IP "setbuf" 4
.IX Item "setbuf"
.IP "setvbuf" 4
.IX Item "setvbuf"
.IP "fdopen" 4
.IX Item "fdopen"
.IP "send/recv" 4
.IX Item "send/recv"
.PD
Note that \fIsend()\fR and \fIrecv()\fR cannot be reliably trapped by a tied filehandle (such as
that used by IO::Socket::SSL) and so may send unencrypted data over the socket.	 Object-oriented
calls to these functions will fail, telling you to use the print/printf/syswrite
and read/sysread families instead.
.SS "Defaults for Cert, Key and \s-1CA\s0"
.IX Subsection "Defaults for Cert, Key and CA"
Only if no SSL_key*, no SSL_cert* and no SSL_ca* options are given it will fall
back to the following builtin defaults:
.IP "SSL_cert_file" 4
.IX Item "SSL_cert_file"
Depending on the SSL_server setting it will be either \f(CW\*(C`certs/server\-cert.pem\*(C'\fR
or \f(CW\*(C`certs/client\-cert.pem\*(C'\fR.
.IP "SSL_key_file" 4
.IX Item "SSL_key_file"
Depending on the SSL_server setting it will be either \f(CW\*(C`certs/server\-key.pem\*(C'\fR
or \f(CW\*(C`certs/client\-key.pem\*(C'\fR.
.IP "SSL_ca_file | SSL_ca_path" 4
.IX Item "SSL_ca_file | SSL_ca_path"
It will set SSL_ca_file to \f(CW\*(C`certs/my\-ca.pem\*(C'\fR if it exist.
Otherwise it will set SSL_ca_path to \f(CW\*(C`ca/\*(C'\fR if it exist.
.PP
\&\fBPlease note, that these defaults are depreciated and will be removed in the
near future\fR, e.g. you should specify all the certificates and keys you use.
If you don't specify a \s-1CA\s0 file or path it will fall back to the system default
built into OpenSSL.
.SH "ERROR HANDLING"
.IX Header "ERROR HANDLING"
If an \s-1SSL\s0 specific error occurs the global variable \f(CW$SSL_ERROR\fR will be set.
If the error occurred on an existing \s-1SSL\s0 socket the method \f(CW\*(C`errstr\*(C'\fR will
give access to the latest socket specific error.
Both \f(CW$SSL_ERROR\fR and \f(CW\*(C`errstr\*(C'\fR method give a dualvar similar to \f(CW$!\fR, e.g.
providing an error number in numeric context or an error description in string
context.
.SH "NON-BLOCKING I/O"
.IX Header "NON-BLOCKING I/O"
If you have a non-blocking socket, the expected behavior on read, write, accept
or connect is to set \f(CW$!\fR to \s-1EAGAIN\s0 if the operation can not be completed
immediately.
.PP
With \s-1SSL\s0 there are cases, like with \s-1SSL\s0 handshakes, where the write operation
can not be completed until it can read from the socket or vice versa. 
In these cases \f(CW$!\fR is set to \s-1EGAIN\s0 like expected, and additionally
\&\f(CW$SSL_ERROR\fR is set to either \s-1SSL_WANT_READ\s0 or \s-1SSL_WANT_WRITE\s0.
Thus if you get \s-1EAGAIN\s0 on a \s-1SSL\s0 socket you must check \f(CW$SSL_ERROR\fR for
SSL_WANT_* and adapt your event mask accordingly.
.PP
Using readline on non-blocking sockets does not make much sense and I would
advise against using it.
And, while the behavior is not documented for other IO::Socket classes, it
will try to emulate the behavior seen there, e.g. to return the received data
instead of blocking, even if the line is not complete. If an unrecoverable error
occurs it will return nothing, even if it already received some data.
.SH "SNI Support"
.IX Header "SNI Support"
Newer extensions to \s-1SSL\s0 can distinguish between multiple hostnames on the same
\&\s-1IP\s0 address using Server Name Indication (\s-1SNI\s0).
.PP
Support for \s-1SNI\s0 on the client side was added somewhere in the OpenSSL 0.9.8
series, but only with 1.0 a bug was fixed when the server could not decide about
its hostname. Therefore client side \s-1SNI\s0 is only supported with OpenSSL 1.0 or
higher in IO::Socket::SSL.
With a supported version, \s-1SNI\s0 is used automatically on the client side, if it can
determine the hostname from \f(CW\*(C`PeerAddr\*(C'\fR or \f(CW\*(C`PeerHost\*(C'\fR. On unsupported OpenSSL
versions it will silently not use \s-1SNI\s0.
The hostname can also be given explicitly given with \f(CW\*(C`SSL_hostname\*(C'\fR, but in
this case it will throw in error, if \s-1SNI\s0 is not supported.
To check for support you might call \f(CW\*(C`IO::Socket::SSL\-\*(C'\fR\fIcan_client_sni()\fR>.
.PP
On the server side earlier versions of OpenSSL are supported, but only together
with Net::SSLeay version >= 1.50.
To check for support you might call \f(CW\*(C`IO::Socket::SSL\-\*(C'\fR\fIcan_server_sni()\fR>.
If server side \s-1SNI\s0 is supported, you might specify different certificates per
host with \f(CW\*(C`SSL_cert*\*(C'\fR and \f(CW\*(C`SSL_key*\*(C'\fR, and check the requested name using
\&\f(CW\*(C`get_servername\*(C'\fR.
.SH "RETURN VALUES"
.IX Header "RETURN VALUES"
A few changes have gone into IO::Socket::SSL v0.93 and later with respect to
return values.	The behavior on success remains unchanged, but for \fIall\fR functions,
the return value on error is now an empty list.	 Therefore, the return value will be
false in all contexts, but those who have been using the return values as arguments
to subroutines (like \f(CW\*(C`mysub(IO::Socket::SSL(...)\-\*(C'\fRnew, ...)>) may run into problems.
The moral of the story: \fIalways\fR check the return values of these functions before
using them in any way that you consider meaningful.
.SH "DEBUGGING"
.IX Header "DEBUGGING"
If you are having problems using IO::Socket::SSL despite the fact that can recite backwards
the section of this documentation labelled 'Using \s-1SSL\s0', you should try enabling debugging.	To
specify the debug level, pass 'debug#' (where # is a number from 0 to 3) to IO::Socket::SSL
when calling it.
The debug level will also be propagated to Net::SSLeay::trace, see also Net::SSLeay:
.IP "use IO::Socket::SSL qw(debug0);" 4
.IX Item "use IO::Socket::SSL qw(debug0);"
No debugging (default).
.IP "use IO::Socket::SSL qw(debug1);" 4
.IX Item "use IO::Socket::SSL qw(debug1);"
Print out errors from IO::Socket::SSL and ciphers from Net::SSLeay.
.IP "use IO::Socket::SSL qw(debug2);" 4
.IX Item "use IO::Socket::SSL qw(debug2);"
Print also information about call flow from IO::Socket::SSL and progress
information from Net::SSLeay.
.IP "use IO::Socket::SSL qw(debug3);" 4
.IX Item "use IO::Socket::SSL qw(debug3);"
Print also some data dumps from IO::Socket::SSL and from Net::SSLeay.
.SH "EXAMPLES"
.IX Header "EXAMPLES"
See the 'example' directory.
.SH "BUGS"
.IX Header "BUGS"
IO::Socket::SSL depends on Net::SSLeay.  Up to version 1.43 of Net::SSLeay
it was not thread safe, although it did probably work if you did not use 
SSL_verify_callback and SSL_password_cb.
.PP
If you use IO::Socket::SSL together with threads you should load it (e.g. use or
require) inside the main thread before creating any other threads which use it.
This way it is much faster because it will be initialized only once. Also there
are reports that it might crash the other way.
.PP
Creating an IO::Socket::SSL object in one thread and closing it in another
thread will not work.
.PP
IO::Socket::SSL does not work together with Storable::fd_retrieve/fd_store.
See \s-1BUGS\s0 file for more information and how to work around the problem.
.PP
Non-blocking and timeouts (which are based on non-blocking) are not
supported on Win32, because the underlying IO::Socket::INET does not support
non-blocking on this platform.
.PP
If you have a server and it looks like you have a memory leak you might 
check the size of your session cache. Default for Net::SSLeay seems to be 
20480, see the example for SSL_create_ctx_callback for how to limit it.
.PP
The default for SSL_verify_mode on the client is currently \s-1SSL_VERIFY_NONE\s0,
which is a very bad idea, thus the default will change in the near future.
See documentation for SSL_verify_mode for more information.
.SH "LIMITATIONS"
.IX Header "LIMITATIONS"
IO::Socket::SSL uses Net::SSLeay as the shiny interface to OpenSSL, which is
the shiny interface to the ugliness of \s-1SSL\s0.	 As a result, you will need both Net::SSLeay
and OpenSSL on your computer before using this module.
.PP
If you have Scalar::Util (standard with Perl 5.8.0 and above) or WeakRef, IO::Socket::SSL
sockets will auto-close when they go out of scope, just like IO::Socket::INET sockets.	If
you do not have one of these modules, then IO::Socket::SSL sockets will stay open until the
program ends or you explicitly close them.	This is due to the fact that a circular reference
is required to make IO::Socket::SSL sockets act simultaneously like objects and glob references.
.SH "DEPRECATIONS"
.IX Header "DEPRECATIONS"
The following functions are deprecated and are only retained for compatibility:
.IP "\fIcontext_init()\fR" 2
.IX Item "context_init()"
use the SSL_reuse_ctx option if you want to re-use a context
.IP "\fIsocketToSSL()\fR and \fIsocket_to_SSL()\fR" 2
.IX Item "socketToSSL() and socket_to_SSL()"
use IO::Socket::SSL\->\fIstart_SSL()\fR instead
.IP "\fIkill_socket()\fR" 2
.IX Item "kill_socket()"
use \fIclose()\fR instead
.IP "\fIget_peer_certificate()\fR" 2
.IX Item "get_peer_certificate()"
use the \fIpeer_certificate()\fR function instead.
Used to return X509_Certificate with methods subject_name and issuer_name.
Now simply returns \f(CW$self\fR which has these methods (although deprecated).
.IP "\fIissuer_name()\fR" 2
.IX Item "issuer_name()"
use peer_certificate( 'issuer' ) instead
.IP "\fIsubject_name()\fR" 2
.IX Item "subject_name()"
use peer_certificate( 'subject' ) instead
.SH "SEE ALSO"
.IX Header "SEE ALSO"
IO::Socket::INET, IO::Socket::INET6, IO::Socket::IP, Net::SSLeay.
.SH "AUTHORS"
.IX Header "AUTHORS"
Steffen Ullrich, <steffen at genua.de> is the current maintainer.
.PP
Peter Behroozi, <behrooz at fas.harvard.edu> (Note the lack of an \*(L"i\*(R" at the end of \*(L"behrooz\*(R")
.PP
Marko Asplund, <marko.asplund at kronodoc.fi>, was the original author of IO::Socket::SSL.
.PP
Patches incorporated from various people, see file Changes.
.SH "COPYRIGHT"
.IX Header "COPYRIGHT"
The original versions of this module are Copyright (C) 1999\-2002 Marko Asplund.
.PP
The rewrite of this module is Copyright (C) 2002\-2005 Peter Behroozi.
.PP
Versions 0.98 and newer are Copyright (C) 2006\-2013 Steffen Ullrich.
.PP
This module is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
.SH "Appendix: Using SSL"
.IX Header "Appendix: Using SSL"
If you are unfamiliar with the way OpenSSL works, good references may be found in
both the book \*(L"Network Security with OpenSSL\*(R" (Oreilly & Assoc.) and the web site
<http://www.tldp.org/HOWTO/SSL\-Certificates\-HOWTO/>.  Read on for a quick overview.
.SS "The Long of It (Detail)"
.IX Subsection "The Long of It (Detail)"
The usual reason for using \s-1SSL\s0 is to keep your data safe.  This means that not only
do you have to encrypt the data while it is being transported over a network, but
you also have to make sure that the right person gets the data.	 To accomplish this
with \s-1SSL\s0, you have to use certificates.	 A certificate closely resembles a
Government-issued \s-1ID\s0 (at least in places where you can trust them).	 The \s-1ID\s0 contains some sort of
identifying information such as a name and address, and is usually stamped with a seal
of Government Approval.	 Theoretically, this means that you may trust the information on
the card and do business with the owner of the card.  The same ideas apply to \s-1SSL\s0 certificates,
which have some identifying information and are \*(L"stamped\*(R" [most people refer to this as
\&\fIsigning\fR instead] by someone (a Certificate Authority) who you trust will adequately
verify the identifying information.	 In this case, because of some clever number theory,
it is extremely difficult to falsify the stamping process.	Another useful consequence
of number theory is that the certificate is linked to the encryption process, so you may
encrypt data (using information on the certificate) that only the certificate owner can
decrypt.
.PP
What does this mean for you?  It means that at least one person in the party has to
have an \s-1ID\s0 to get drinks :\-).  Seriously, it means that one of the people communicating
has to have a certificate to ensure that your data is safe.	 For client/server
interactions, the server must \fBalways\fR have a certificate.	 If the server wants to
verify that the client is safe, then the client must also have a personal certificate.
To verify that a certificate is safe, one compares the stamped \*(L"seal\*(R" [commonly called
an \fIencrypted digest/hash/signature\fR] on the certificate with the official \*(L"seal\*(R" of
the Certificate Authority to make sure that they are the same.	To do this, you will
need the [unfortunately named] certificate of the Certificate Authority.  With all these
in hand, you can set up a \s-1SSL\s0 connection and be reasonably confident that no-one is
reading your data.
.SS "The Short of It (Summary)"
.IX Subsection "The Short of It (Summary)"
For servers, you will need to generate a cryptographic private key and a certificate
request.  You will need to send the certificate request to a Certificate Authority to
get a real certificate back, after which you can start serving people.	For clients,
you will not need anything unless the server wants validation, in which case you will
also need a private key and a real certificate.	 For more information about how to
get these, see <http://www.modssl.org/docs/2.8/ssl_faq.html#ToC24>.

Zerion Mini Shell 1.0