add tests to add_revoker and add_certifier that more than one key was not found when...
[monkeysphere.git] / src / keytrans / pem2openpgp
index e9056442effc9b08f3746a80f112430924174440..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();
 
@@ -495,11 +498,8 @@ my $datatosign =
   $sig_data_to_be_hashed.
   $trailer;
 
-print STDERR $datatosign;
-
 my $data_hash = Digest::SHA1::sha1_hex($datatosign);
 
-
 my $issuer_packet = pack('CCa8', 9, $subpacket_types->{issuer}, $keyid);
 
 my $sig = Crypt::OpenSSL::Bignum->new_from_bin($rsa->sign($datatosign));