1Net::SSLGlue::Socket(3)User Contributed Perl DocumentatioNnet::SSLGlue::Socket(3)
2
3
4
6 Net::SSLGlue::Socket - socket which can be either SSL or plain IP
7 (IPv4/IPv6)
8
10 use Net::SSLGlue::Socket;
11 # SSL right from start
12 my $ssl = Net::SSLGlue::Socket->new(
13 PeerHost => ..., # IPv4|IPv6 address
14 PeerPort => ...,
15 SSL => 1,
16 SSL_ca_path => ...
17 );
18
19 # SSL through upgrade of plain connection
20 my $plain = Net::SSLGlue::Socket->new(...);
21 $plain->start_SSL( SSL_ca_path => ... );
22 ...
23 $plain->stop_SSL
24
26 First, it is recommended to use IO::Socket::SSL directly instead of
27 this module, since this kind of functionality is available in
28 IO::Socket::SSL since version 1.994.
29
30 Net::SSLGlue::Socket implements a socket which can be either plain or
31 SSL. If IO::Socket::IP or IO::Socket::INET6 are installed it will also
32 transparently handle IPv6 connections.
33
34 A socket can be either start directly with SSL or it can be start plain
35 and later be upgraded to SSL (because of a STARTTLS commando or
36 similar) and also downgraded again.
37
38 It is possible but not recommended to use the socket in non-blocking
39 mode, because in this case special care must be taken with SSL (see
40 documentation of IO::Socket::SSL).
41
42 Additionally to the usual socket methods the following methods are
43 defined or extended:
44
46 new The method "new" of Net::SSLGlue::Socket can have the argument SSL.
47 If this is true the SSL upgrade will be done immediatly. If not set
48 any SSL_* args will still be saved and used at a later start_SSL
49 call.
50
51 start_SSL
52 This will upgrade the plain socket to SSL. See IO::Socket::SSL for
53 arguments to "start_SSL". Any SSL_* arguments given to new will be
54 applied here too.
55
56 stop_SSL
57 This will downgrade the socket from SSL to plain.
58
59 peer_certificate ...
60 Once the SSL connection is established you can use this method to
61 get information about the certificate. See the IO::Socket::SSL
62 documentation.
63
64 can_read(timeout)
65 This will check for available data. For a plain socket this will
66 only use "select" to check the socket, but for SSL it will check if
67 there are any pending data before trying a select. Because SSL
68 needs to read the whole frame before decryption can be done, a
69 successful return of can_read is no guarantee that data can be read
70 immediatly, only that new data are either available or in the
71 process of arriving.
72
74 IO::Socket::SSL
75
77 This module is copyright (c) 2013..2015, Steffen Ullrich. All Rights
78 Reserved. This module is free software. It may be used, redistributed
79 and/or modified under the same terms as Perl itself.
80
81
82
83perl v5.32.0 2020-07-28 Net::SSLGlue::Socket(3)