diff options
author | Daniel Kahn Gillmor <dkg@fifthhorseman.net> | 2009-02-28 20:36:46 -0500 |
---|---|---|
committer | Daniel Kahn Gillmor <dkg@fifthhorseman.net> | 2009-02-28 20:36:46 -0500 |
commit | a4375ee022de3c6ac6b3be371e1372bb8d720bb3 (patch) | |
tree | 8e8eedb1ae033def65fde22c0e2a5acc9b38a33e | |
parent | 2f91cf1747c882c9db1e8cde2ed00e5d909ff122 (diff) |
test for presence of User ID in pem2openpgp.
-rwxr-xr-x | src/keytrans/pem2openpgp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/keytrans/pem2openpgp b/src/keytrans/pem2openpgp index 37b372a..73becfe 100755 --- a/src/keytrans/pem2openpgp +++ b/src/keytrans/pem2openpgp @@ -724,6 +724,14 @@ for (basename($0)) { if (/^pem2openpgp$/) { my $rsa; my $stdin; + + my $uid = shift; + defined($uid) or die "You must specify a user ID string.\n"; + + # FIXME: fail if there is no given user ID; or should we default to + # hostname_long() from Sys::Hostname::Long ? + + if (defined $ENV{PEM2OPENPGP_NEWKEY}) { $rsa = Crypt::OpenSSL::RSA->generate_key($ENV{PEM2OPENPGP_NEWKEY}); } else { @@ -735,11 +743,6 @@ for (basename($0)) { $rsa = Crypt::OpenSSL::RSA->new_private_key($stdin); } - my $uid = shift; - - # FIXME: fail if there is no given user ID; or should we default to - # hostname_long() from Sys::Hostname::Long ? - print pem2openpgp($rsa, $uid, { timestamp => $ENV{PEM2OPENPGP_TIMESTAMP}, |