1Net::SSH::Perl::Key(3)User Contributed Perl DocumentationNet::SSH::Perl::Key(3)
2
3
4

NAME

6       Net::SSH::Perl::Key - Public or private key abstraction
7

SYNOPSIS

9           use Net::SSH::Perl::Key;
10           my $key = Net::SSH::Perl::Key->new;
11

DESCRIPTION

13       Net::SSH::Perl::Key implements an abstract base class interface to key
14       objects (either DSA, RSA, or Ed25519 keys, currently).  The underlying
15       implementation for RSA, and DSA keys is the CryptX module.  The Ed25519
16       implementation uses bundled XS and C code from the SUPERCOP ref10
17       implementation.
18

USAGE

20   Net::SSH::Perl::Key->new($key_type [, $blob [, $compat_flag_ref ]])
21       Creates a new object of type Net::SSH::Perl::Key::$key_type, after
22       loading the class implementing $key_type.  should be "DSA", "RSA1",
23       "RSA", or "Ed25519".
24
25       $blob, if present, should be a string representation of the key, from
26       which the key object can be initialized. In fact, it should be the
27       representation that is returned from the as_blob method, below.
28
29       $compat_flag_ref should be a reference to the SSH compatibility flag,
30       which is generally stored inside of the Net::SSH::Perl object. This
31       flag is used by certain key implementations ("DSA") to work around
32       differences between SSH2 protocol implementations.
33
34       Returns the new key object, which is blessed into the subclass.
35
36   Net::SSH::Perl::Key->read_private($key_type, $file [, $pass])
37       Reads a private key of type $key_type out of the key file $file. If the
38       private key is encrypted, an attempt will be made to decrypt it using
39       the passphrase $pass; if $pass is not provided, the empty string will
40       be used. An empty passphrase can be a handy way of providing password-
41       less access using publickey authentication.
42
43       If for any reason loading the key fails, returns undef; most of the
44       time, if loading the key fails, it's because the passphrase is
45       incorrect. If you first tried to read the key using an empty
46       passphrase, this might be a good time to ask the user for the actual
47       passphrase. :)
48
49       Returns the new key object, which is blessed into the subclass denoted
50       by $key_type ("DSA", "RSA1" or "Ed25519").
51
52   Net::SSH::Perl::Key->keygen($key_type, $bits)
53       $key_type is one of RSA or DSA.  Generates a new key and returns that
54       key. The key returned is the private key, which (presumably) contains
55       all of the public key data, as well. $bits is the number of bits in the
56       key.
57
58       Your $key_type implementation may not support key generation; if not,
59       calling this method is a fatal error.
60
61       Returns the new key object, which is blessed into the subclass denoted
62       by $key_type
63
64   Net::SSH::Perl::Key->keygen('Ed25519')
65       Generates a new Ed25519 key.  Ed25519 keys have fixed key length.
66
67       Returns the new key object, which is bless into the Ed25519 subclass.
68
69   Net::SSH::Perl::Key->extract_public($key_type, $key_string)
70       Given a key string $key_string, which should be a textual
71       representation of the public portion of a key of $key_type, extracts
72       the key attributes out of that string. This is used to extract public
73       keys out of entries in known_hosts and public identity files.
74
75       Returns the new key object, which is blessed into the subclass denoted
76       by $key_type
77
78   $key->write_private([ $file [, $pass, $ciphername, $rounds] ])
79       Writes out the private key $key to $file, and encrypts it using the
80       passphrase $pass. If $pass is not provided, the key is unencrypted, and
81       the only security protection is through filesystem protections.  For
82       Ed25519 keys, optional parameters ciphername and rounds can be passed
83       to specify the desired cipher to encrypt the key with and how many
84       rounds of encryption to employ, respectively.
85
86       If $file is not provided, returns the content that would have been
87       written to the key file.
88
89   $key->dump_public
90       Performs the inverse of extract_public: takes a key $key and dumps out
91       a textual representation of the public portion of the key. This is used
92       when writing public key entries to known_hosts and public identity
93       files.
94
95       Returns the textual representation.
96
97   $key->as_blob
98       Returns a string representation of the public portion of the key; this
99       is not the same as dump_public, which is intended to match the format
100       used in known_hosts, etc.  The return value of as_blob is used as an
101       intermediary in computing other values: the key fingerprint, the known
102       hosts representation, etc.
103
104   $key->equal($key2)
105       Returns true if the public portions of $key are equal to those of
106       $key2, and false otherwise. This is used when comparing server host
107       keys to keys in known_hosts.
108
109   $key->size
110       Returns the size (in bits) of the key $key.
111
112   $key->fingerprint([ $type ])
113       Returns a fingerprint of $key. The default fingerprint is a SHA256
114       representation.  If $type is equal to "bubblebabble", the Bubble Babble
115       representation of the fingerprint is used.  If $type is equal to "hex",
116       a traditional hex representation is returned.
117
118       The hex representation uses an MD5 digest of the public key, and the
119       bubblebabble uses a SHA-1 digest.
120

AUTHOR & COPYRIGHTS

122       Please see the Net::SSH::Perl manpage for author, copyright, and
123       license information.
124
125
126
127perl v5.28.0                      2018-07-15            Net::SSH::Perl::Key(3)
Impressum