[Pkg-privacy-commits] [msva-perl] 307/356: make use of PGPExtension in X.509 public key carriers

Ximin Luo infinity0 at moszumanska.debian.org
Mon Aug 24 07:42:08 UTC 2015


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch debian
in repository msva-perl.

commit 6623d49cdd0655c1a1545e0d1a49785244de010d
Author: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
Date:   Mon Mar 14 01:08:17 2011 -0400

    make use of PGPExtension in X.509 public key carriers
---
 Changelog                  |  4 +++-
 Crypt/Monkeysphere/MSVA.pm | 16 +++++++++++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/Changelog b/Changelog
index ba076ba..03c8069 100644
--- a/Changelog
+++ b/Changelog
@@ -16,8 +16,10 @@ msva-perl (0.9~pre) upstream;
   * Now depending on Crypt::X509 0.50 for pubkey components directly.
   * Crypt::Monkeysphere::OpenPGP for helper functions in
     packet generation and parsing.
+  * Parse and make use of X.509 PGPExtension if present in X.509 public
+    key carrier.
 
- -- Daniel Kahn Gillmor <dkg at fifthhorseman.net>  Fri, 11 Mar 2011 01:24:55 -0500
+ -- Daniel Kahn Gillmor <dkg at fifthhorseman.net>  Mon, 14 Mar 2011 01:07:50 -0400
 
 msva-perl (0.8) upstream;
 
diff --git a/Crypt/Monkeysphere/MSVA.pm b/Crypt/Monkeysphere/MSVA.pm
index 5c48fa1..0b71816 100755
--- a/Crypt/Monkeysphere/MSVA.pm
+++ b/Crypt/Monkeysphere/MSVA.pm
@@ -38,6 +38,7 @@
   use Crypt::Monkeysphere::Logger;
   use Crypt::Monkeysphere::Util qw(untaint);
   use Crypt::Monkeysphere::MSVA::Monitor;
+  use Crypt::Monkeysphere::OpenPGP;
 
   use JSON;
   use POSIX qw(strftime);
@@ -442,6 +443,16 @@
         if (! defined $key) {
           msvalog('verbose', "failed to decode %s\n", unpack('H*', $cert->pubkey()));
           $key = {error => 'failed to decode the public key'};
+        } else {
+          # ensure these are Math::BigInts!
+          $key->{exponent} = Math::BigInt::->new($key->{exponent}) unless (ref($key->{exponent}));
+          $key->{modulus} = Math::BigInt::->new($key->{modulus}) unless (ref($key->{modulus}));
+
+          my $pgpext = $cert->PGPExtension();
+          if (defined $pgpext) {
+            $key->{openpgp4fpr} = Crypt::Monkeysphere::OpenPGP::fingerprint($key, $pgpext);
+            msvalog('verbose', "OpenPGP Fingerprint (derived from X.509 cert): 0x%s\n", uc(unpack("H*", $key->{openpgp4fpr})));
+          }
         }
       }
     }
@@ -625,7 +636,6 @@
       if ($data->{pkc}->{data} =~ /^(0x)?([[:xdigit:]]{40})$/) {
 	$data->{pkc}->{data} = uc($2);
 	$fpr = $data->{pkc}->{data};
-	msvalog('verbose', "OpenPGP v4 fingerprint: %s\n",$fpr);
       } else {
 	msvalog('error', "invalid OpenPGP v4 fingerprint: %s\n",$data->{pkc}->{data});
 	$ret->{message} = sprintf("Invalid OpenPGP v4 fingerprint.");
@@ -638,7 +648,11 @@
 	$ret->{message} = $key->{error};
 	return $status,$ret;
       }
+      $fpr = uc(unpack('H*', $key->{openpgp4fpr}))
+        if (exists $key->{openpgp4fpr});
     }
+    msvalog('verbose', "OpenPGP v4 fingerprint: %s\n",$fpr)
+      if defined $fpr;
 
     # determine keyserver policy
     my $kspolicy;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/msva-perl.git



More information about the Pkg-privacy-commits mailing list