1Net::SSH::Perl::Cipher(U3s)er Contributed Perl DocumentatNieotn::SSH::Perl::Cipher(3)
2
3
4

NAME

6       Net::SSH::Perl::Cipher - Base cipher class, plus utility methods
7

SYNOPSIS

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

DESCRIPTION

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

UTILITY METHODS

26       supported( [ protocol => $protocol, ] [ $ciph_id [, $server_supports ]
27       ])
28
29       Without arguments returns a reference to an array of ciphers supported
30       by Net::SSH::Perl. These are ciphers that have working
31       Net::SSH::Perl::Cipher:: implementations, essentially.  Pass 'protocol
32       => 2' to get a list of SSH2 ciphers.
33
34       With one argument $ciph_id, returns a true value if that cipher is sup‐
35       ported by Net::SSH::Perl, and false otherwise.
36
37       With two arguments, $ciph_id and $server_supports, returns true if the
38       cipher represented by $ciph_id is supported both by Net::SSH::Perl and
39       by the sshd server. The list of ciphers supported by the server should
40       be in $server_supports, a bit mask sent from the server during the ses‐
41       sion identification phase.
42
43       Can be called either as a non-exported function, i.e.
44
45           my $i_support = Net::SSH::Perl::Cipher::supported();
46
47       or as an object method of a Net::SSH::Perl::Cipher object, or an object
48       of a subclass:
49
50           if ($ciph->supported($server_supports)) {
51               print "Server supports cipher $ciph";
52           }
53
54       id( [ $cipher_name ] )
55
56       Translates a cipher name into a cipher ID.
57
58       If given $cipher_name translates that name into the corresponding ID.
59       If called as an object method, translates the object's cipher class
60       name into the ID.
61
62       name( [ $cipher_id ] )
63
64       Translates a cipher ID into a cipher name.
65
66       If given $cipher_id translates that ID into the corresponding name. If
67       called as an object method, returns the (stripped) object's cipher
68       class name; for example, if the object were of type
69       Net::SSH::Perl::Cipher::IDEA, name would return IDEA.
70

CIPHER USAGE

72       Net::SSH::Perl::Cipher->new($cipher_name, $key)
73
74       Instantiates a new cipher object of the type $cipher_name with the key
75       $key; returns the cipher object, which will be blessed into the actual
76       cipher subclass.
77
78       If $cipher_name is the special type 'None' (no encryption cipher), the
79       object will actually be blessed directly into the base class, and text
80       to be encrypted and decrypted will be passed through without change.
81
82       $cipher->encrypt($text)
83
84       Encrypts $text and returns the encrypted string.
85
86       $cipher->decrypt($text)
87
88       Decrypts $text and returns the decrypted string.
89

CIPHER DEVELOPMENT

91       Classes implementing an encryption cipher must implement the following
92       three methods:
93
94       * $class->new($key)
95           Given a key $key, should construct a new cipher object and bless it
96           into $class, presumably.
97
98       * $cipher->encrypt($text)
99           Given plain text $text, should encrypt the text and return the
100           encrypted string.
101
102       * $cipher->decrypt($text)
103           Given encrypted text $text, should decrypt the text and return the
104           decrypted string.
105

AUTHOR & COPYRIGHTS

107       Please see the Net::SSH::Perl manpage for author, copyright, and
108       license information.
109
110
111
112perl v5.8.8                       2003-12-03         Net::SSH::Perl::Cipher(3)
Impressum