1Net::SSH::Perl::Cipher(U3s)er Contributed Perl DocumentatNieotn::SSH::Perl::Cipher(3)
2
3
4
6 Net::SSH::Perl::Cipher - Base cipher class, plus utility methods
7
9 use Net::SSH::Perl::Cipher;
10
11 # Get list of supported cipher IDs.
12 my $supported = Net::SSH::Perl::Cipher::supported();
13
14 # Translate a cipher name into an ID.
15 my $id = Net::SSH::Perl::Cipher::id($name);
16
17 # Translate a cipher ID into a name.
18 my $name = Net::SSH::Perl::Cipher::name($id);
19
21 Net::SSH::Perl::Cipher provides a base class for each of the encryption
22 cipher classes. In addition, it defines a set of utility methods that
23 can be called either as functions or object methods.
24
26 supported( [ protocol => $protocol, ] [ $ciph_id [, $server_supports ] ])
27 Without arguments returns a reference to an array of ciphers supported
28 by Net::SSH::Perl. These are ciphers that have working
29 Net::SSH::Perl::Cipher:: implementations, essentially. Pass 'protocol
30 => 2' to get a list of SSH2 ciphers.
31
32 With one argument $ciph_id, returns a true value if that cipher is
33 supported by Net::SSH::Perl, and false otherwise.
34
35 With two arguments, $ciph_id and $server_supports, returns true if the
36 cipher represented by $ciph_id is supported both by Net::SSH::Perl and
37 by the sshd server. The list of ciphers supported by the server should
38 be in $server_supports, a bit mask sent from the server during the
39 session identification phase.
40
41 Can be called either as a non-exported function, i.e.
42
43 my $i_support = Net::SSH::Perl::Cipher::supported();
44
45 or as an object method of a Net::SSH::Perl::Cipher object, or an object
46 of a subclass:
47
48 if ($ciph->supported($server_supports)) {
49 print "Server supports cipher $ciph";
50 }
51
52 id( [ $cipher_name ] )
53 Translates a cipher name into a cipher ID.
54
55 If given $cipher_name translates that name into the corresponding ID.
56 If called as an object method, translates the object's cipher class
57 name into the ID.
58
59 name( [ $cipher_id ] )
60 Translates a cipher ID into a cipher name.
61
62 If given $cipher_id translates that ID into the corresponding name. If
63 called as an object method, returns the (stripped) object's cipher
64 class name; for example, if the object were of type
65 Net::SSH::Perl::Cipher::IDEA, name would return IDEA.
66
68 Net::SSH::Perl::Cipher->new($cipher_name, $key)
69 Instantiates a new cipher object of the type $cipher_name with the key
70 $key; returns the cipher object, which will be blessed into the actual
71 cipher subclass.
72
73 If $cipher_name is the special type 'None' (no encryption cipher), the
74 object will actually be blessed directly into the base class, and text
75 to be encrypted and decrypted will be passed through without change.
76
77 $cipher->encrypt($text)
78 Encrypts $text and returns the encrypted string.
79
80 $cipher->decrypt($text)
81 Decrypts $text and returns the decrypted string.
82
84 Classes implementing an encryption cipher must implement the following
85 three methods:
86
87 · $class->new($key)
88
89 Given a key $key, should construct a new cipher object and bless it
90 into $class, presumably.
91
92 · $cipher->encrypt($text)
93
94 Given plain text $text, should encrypt the text and return the
95 encrypted string.
96
97 · $cipher->decrypt($text)
98
99 Given encrypted text $text, should decrypt the text and return the
100 decrypted string.
101
103 Please see the Net::SSH::Perl manpage for author, copyright, and
104 license information.
105
106
107
108perl v5.12.2 2008-09-24 Net::SSH::Perl::Cipher(3)