Parse-SSH2-PublicKey
view release on metacpan or search on metacpan
t/parse-file.t view on Meta::CPAN
# parse SECSH format
($tfh, $tempfile) = tempfile();
if ( write_file( $tempfile, $secsh_pub ) ) {
@keys = Parse::SSH2::PublicKey->parse_file( $tempfile );
$k = $keys[0];
isa_ok( $k, 'Parse::SSH2::PublicKey', 'Got Parse::SSH2::PublicKey object' );
is( $k->comment, '"2048-bit rsa, user@host, Wed Dec 09 2009 13:26:29 -0600 and Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat."', 'SECSH key comment'...
is( $k->subject, '"sshuser AT domain DOT tld would be my email address if I were to register it. Filler text will go here. We use filler text to take up space as if it were a valid block of text, but in this case its not valid for anything except...
is( $k->key, 'AAAAB3NzaC1yc2EAAAADAQABAAABAQDGeSou4mEWqx2Lx8JIxOxH5MiVuXxJJrs36QOxzNmoskL6cUP4CO0TZtoqtnjVvaWryBfS65HNC9Q0KuTqLpXNTu+056mmhzvqJg5K6mhhtz447sMl+a5xrpS64I9uNKOIpjptRIvk8IaF//bY9n3DRLWSjxLwPVH8kZRQvWVtut3PKc5K/PngAd/AALRlMrBYFGY1AHDm...
is ( $k->encryption, 'ssh-rsa', 'RSA key' );
is ( $k->type, 'public', 'Public key' );
undef $k; undef @keys;
}
undef $tfh; undef $tempfile;
# parse openssh rsa keys...
($tfh, $tempfile) = tempfile();
if ( write_file( $tempfile, $openssh_rsa_pub ) ) {
( run in 0.511 second using v1.01-cache-2.11-cpan-0a6323c29d9 )