6 my @lines = (-t STDIN
) ?
() : <>;
9 die "Usage: $0 < key.sec > key.pub\n";
12 my $seckey = decode_base64
(pop @lines);
13 my $comment = shift(@lines) || "untrusted comment: secret key";
17 $comment =~ s/\bsecret key$/public key/;
19 if (length($seckey) != 104) {
20 die "Unexpected secret key length\n";
23 my $pubkey = encode_base64
(substr($seckey, 0, 2) . substr($seckey, 32, 8) . substr($seckey, 72), "");
25 printf "%s\n%s\n", $comment, $pubkey;