diff options
author | Daniel Kahn Gillmor <dkg@fifthhorseman.net> | 2010-04-17 15:57:47 -0400 |
---|---|---|
committer | Daniel Kahn Gillmor <dkg@fifthhorseman.net> | 2010-04-17 15:57:47 -0400 |
commit | 056ccb1b87edac25d29736f9835a4e29be6e3205 (patch) | |
tree | 8e76b68ed4aeb23967db69a42fc499d02613bad1 /src/share/keytrans | |
parent | 396c76edb06a7b15db27747555fe6b2dcd6ff798 (diff) |
added internal openpgp2sshfpr subcommand for keytrans
Diffstat (limited to 'src/share/keytrans')
-rwxr-xr-x | src/share/keytrans | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/share/keytrans b/src/share/keytrans index 255a271..ae887de 100755 --- a/src/share/keytrans +++ b/src/share/keytrans @@ -1144,6 +1144,19 @@ for (basename($0)) { binmode($instream, ":bytes"); my $keys = getallprimarykeys($instream); printf("%s\n", join("\n", map { uc(unpack('H*', $_)) } keys(%{$keys}))); + } elsif (/^openpgp2sshfpr$/) { + my $fpr = shift; + my $instream; + open($instream,'-'); + binmode($instream, ":bytes"); + my $key = openpgp2rsa($instream, $fpr); + if (defined($key)) { + # openssh uses MD5 for key fingerprints: + use Digest::MD5; + printf("%s\n", join(':', map({unpack("H*", $_)} split(//, Digest::MD5::md5(openssh_pubkey_pack($key)))))); + } else { + die "No matching key found.\n"; + } } else { die "Unrecognized subcommand. keytrans subcommands are not a stable interface!\n"; } |