.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.37 .\" .\" Standard preamble: .\" ======================================================================== .de Sh \" Subsection heading .br .if t .Sp .ne 5 .PP \fB\\$1\fR .PP .. .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. | will give a .\" real vertical bar. \*(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-|\(bv\*(Tr .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\} .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .\" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .hy 0 .if n .na .\" .\" 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 "Net::SSH::Perl::Key 3" .TH Net::SSH::Perl::Key 3 "2008-10-02" "perl v5.8.8" "User Contributed Perl Documentation" .SH "NAME" Net::SSH::Perl::Key \- Public or private key abstraction .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& use Net::SSH::Perl::Key; \& my $key = Net::SSH::Perl::Key->new; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\fINet::SSH::Perl::Key\fR implements an abstract base class interface to key objects (either \s-1DSA\s0 or \s-1RSA\s0 keys, currently). The underlying implementation for \s-1RSA\s0 is an internal, hash-reference implementation; the \s-1DSA\s0 implementation uses \fICrypt::DSA\fR. .SH "USAGE" .IX Header "USAGE" .ie n .Sh "Net::SSH::Perl::Key\->new($key_type [, $blob\fP [, \f(CW$compat_flag_ref ]])" .el .Sh "Net::SSH::Perl::Key\->new($key_type [, \f(CW$blob\fP [, \f(CW$compat_flag_ref\fP ]])" .IX Subsection "Net::SSH::Perl::Key->new($key_type [, $blob [, $compat_flag_ref ]])" Creates a new object of type \fINet::SSH::Perl::Key::$key_type\fR, after loading the class implementing \fI$key_type\fR. \fI$key_type\fR should be either \f(CW\*(C`DSA\*(C'\fR or \f(CW\*(C`RSA1\*(C'\fR, currently; these are the only supported key implementations at the moment. .PP \&\fI$blob\fR, if present, should be a string representation of the key, from which the key object can be initialized. In fact, it should be the representation that is returned from the \fIas_blob\fR method, below. .PP \&\fI$compat_flag_ref\fR should be a reference to the \s-1SSH\s0 compatibility flag, which is generally stored inside of the \fINet::SSH::Perl\fR object. This flag is used by certain key implementations (\f(CW\*(C`DSA\*(C'\fR) to work around differences between \s-1SSH2\s0 protocol implementations. .PP Returns the new key object, which is blessed into the subclass. .ie n .Sh "Net::SSH::Perl::Key\->read_private($key_type, $file\fP [, \f(CW$pass])" .el .Sh "Net::SSH::Perl::Key\->read_private($key_type, \f(CW$file\fP [, \f(CW$pass\fP])" .IX Subsection "Net::SSH::Perl::Key->read_private($key_type, $file [, $pass])" Reads a private key of type \fI$key_type\fR out of the key file \&\fI$file\fR. If the private key is encrypted, an attempt will be made to decrypt it using the passphrase \fI$pass\fR; if \fI$pass\fR is not provided, the empty string will be used. An empty passphrase can be a handy way of providing password-less access using publickey authentication. .PP If for any reason loading the key fails, returns \fIundef\fR; most of the time, if loading the key fails, it's because the passphrase is incorrect. If you first tried to read the key using an empty passphrase, this might be a good time to ask the user for the actual passphrase. :) .PP Returns the new key object, which is blessed into the subclass denoted by \fI$key_type\fR (either \f(CW\*(C`DSA\*(C'\fR or \f(CW\*(C`RSA1\*(C'\fR). .ie n .Sh "Net::SSH::Perl::Key\->keygen($key_type, $bits)" .el .Sh "Net::SSH::Perl::Key\->keygen($key_type, \f(CW$bits\fP)" .IX Subsection "Net::SSH::Perl::Key->keygen($key_type, $bits)" Generates a new key and returns that key. The key returned is the private key, which (presumably) contains all of the public key data, as well. \fI$bits\fR is the number of bits in the key. .PP Your \fI$key_type\fR implementation may not support key generation; if not, calling this method is a fatal error. .PP Returns the new key object, which is blessed into the subclass denoted by \fI$key_type\fR (either \f(CW\*(C`DSA\*(C'\fR or \f(CW\*(C`RSA1\*(C'\fR). .ie n .Sh "Net::SSH::Perl::Key\->extract_public($key_type, $key_string)" .el .Sh "Net::SSH::Perl::Key\->extract_public($key_type, \f(CW$key_string\fP)" .IX Subsection "Net::SSH::Perl::Key->extract_public($key_type, $key_string)" Given a key string \fI$key_string\fR, which should be a textual representation of the public portion of a key of \fI$key_type\fR, extracts the key attributes out of that string. This is used to extract public keys out of entries in \fIknown_hosts\fR and public identity files. .PP Returns the new key object, which is blessed into the subclass denoted by \fI$key_type\fR (either \f(CW\*(C`DSA\*(C'\fR or \f(CW\*(C`RSA1\*(C'\fR). .ie n .Sh "$key\->write_private([ $file\fP [, \f(CW$pass] ])" .el .Sh "$key\->write_private([ \f(CW$file\fP [, \f(CW$pass\fP] ])" .IX Subsection "$key->write_private([ $file [, $pass] ])" Writes out the private key \fI$key\fR to \fI$file\fR, and encrypts it using the passphrase \fI$pass\fR. If \fI$pass\fR is not provided, the key is unencrypted, and the only security protection is through filesystem protections. .PP If \fI$file\fR is not provided, returns the content that would have been written to the key file. .Sh "$key\->dump_public" .IX Subsection "$key->dump_public" Performs the inverse of \fIextract_public\fR: takes a key \fI$key\fR and dumps out a textual representation of the public portion of the key. This is used when writing public key entries to \&\fIknown_hosts\fR and public identity files. .PP Returns the textual representation. .Sh "$key\->as_blob" .IX Subsection "$key->as_blob" Returns a string representation of the public portion of the key; this is \fInot\fR the same as \fIdump_public\fR, which is intended to match the format used in \fIknown_hosts\fR, etc. The return value of \fIas_blob\fR is used as an intermediary in computing other values: the key fingerprint, the known hosts representation, etc. .Sh "$key\->equal($key2)" .IX Subsection "$key->equal($key2)" Returns true if the public portions of \fI$key\fR are equal to those of \fI$key2\fR, and false otherwise. This is used when comparing server host keys to keys in \fIknown_hosts\fR. .Sh "$key\->size" .IX Subsection "$key->size" Returns the size (in bits) of the key \fI$key\fR. .Sh "$key\->fingerprint([ \fI$type\fP ])" .IX Subsection "$key->fingerprint([ $type ])" Returns a fingerprint of \fI$key\fR. The default fingerprint is a hex representation; if \fI$type\fR is equal to \f(CW\*(C`bubblebabble\*(C'\fR, the Bubble Babble representation of the fingerprint is used instead. The former uses an \fI\s-1MD5\s0\fR digest of the public key, and the latter uses a \fI\s-1SHA\-1\s0\fR digest. .SH "AUTHOR & COPYRIGHTS" .IX Header "AUTHOR & COPYRIGHTS" Please see the Net::SSH::Perl manpage for author, copyright, and license information.