From 4787fbc1560c18b96b53090c0671fa7e997ccfa2 Mon Sep 17 00:00:00 2001 From: David Bremner Date: Sun, 24 Apr 2011 07:29:33 -0300 Subject: [PATCH] GnuPGKey_to_OpenSSH_pub cleanup. - add some documentation, particularly the need to prepend "ssh-rsa " - remove 'use Data::Dumper' - add to EXPORT_OK --- Crypt/Monkeysphere/Keytrans.pm | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/Crypt/Monkeysphere/Keytrans.pm b/Crypt/Monkeysphere/Keytrans.pm index ab021d7..1754a76 100644 --- a/Crypt/Monkeysphere/Keytrans.pm +++ b/Crypt/Monkeysphere/Keytrans.pm @@ -7,7 +7,7 @@ use Carp; use MIME::Base64; use Exporter qw(import); -our @EXPORT_OK=qw(); +our @EXPORT_OK=qw(GnuPGKey_to_OpenSSH_pub); # takes a Math::BigInt and returns it properly packed for openssh output. @@ -47,6 +47,20 @@ sub openssh_rsa_pubkey_pack { openssh_mpi_pack($modulus); } +=pod + +=head2 GnuPGKey_to_OpenSSH_pub + +Translate a GnuPG::Key to a string suitable for an OpenSSH .pub file + +B you will need to add "ssh-rsa " to the front to make OpenSSH +recognize it. + +=head3 Arguments + +key - GnuPG::Key object + +=cut sub GnuPGKey_to_OpenSSH_pub { my $key = shift; @@ -57,8 +71,6 @@ sub GnuPGKey_to_OpenSSH_pub { croak("Not an RSA key!") unless $key->algo_num == 1; - use Data::Dumper; - return encode_base64(openssh_rsa_pubkey_pack(@{$key->pubkey_data}), ''); } -- 2.26.2