pem2openpgp now supports generating the key as an alternative to reading it from...
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Thu, 5 Feb 2009 19:11:04 +0000 (14:11 -0500)
committerDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Thu, 5 Feb 2009 19:11:04 +0000 (14:11 -0500)
src/keytrans/pem2openpgp

index c765002b2a1cec100b95476589e105e06d51dfd0..2631da6e99b8bb04bb2a91b5df6be69171f7bea6 100755 (executable)
@@ -347,13 +347,16 @@ sub fingerprint {
   return Digest::SHA1::sha1(pack('Cn', 0x99, length($rsabody)).$rsabody);
 }
 
-# we're just not dealing with newline business right now.  slurp in
-# the whole file.
-undef $/;
-my $buf = <STDIN>;
 
-
-my $rsa = Crypt::OpenSSL::RSA->new_private_key($buf);
+my $rsa;
+if (defined $ENV{PEM2OPENPGP_NEWKEY}) {
+  $rsa = Crypt::OpenSSL::RSA->generate_key($ENV{PEM2OPENPGP_NEWKEY});
+} else {
+  # we're just not dealing with newline business right now.  slurp in
+  # the whole file.
+  undef $/;
+  $rsa = Crypt::OpenSSL::RSA->new_private_key(<STDIN>);
+}
 
 $rsa->use_sha1_hash();