[Pkg-privacy-commits] [msva-perl] 37/356: do some parsing of the incoming certificate

Ximin Luo infinity0 at moszumanska.debian.org
Mon Aug 24 07:41:37 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 81f28e7f4c5c7b8b4dee46c39a13cc2628e167ea
Author: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
Date:   Sat Jan 9 19:39:17 2010 -0500

    do some parsing of the incoming certificate
---
 msva | 25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/msva b/msva
index 785c061..09279bb 100755
--- a/msva
+++ b/msva
@@ -10,6 +10,8 @@ use strict;
   use base qw(HTTP::Server::Simple::CGI);
   use warnings;
   use strict;
+  use Crypt::GPG;
+  use Crypt::X509;
 
   use JSON;
 
@@ -18,6 +20,18 @@ use strict;
                   '/extracerts' => \&extracerts,
                  );
 
+
+  sub new {
+    my $class = shift;
+    # start the server on port 8901
+    my $self = $class->SUPER::new(8901);
+
+    $self->{_gpg} = new Crypt::GPG;
+
+    bless ($self, $class);
+    return $self;
+  }
+
   sub handle_request {
     my $self = shift;
     my $cgi  = shift;
@@ -47,10 +61,14 @@ use strict;
     my $data = from_json($cgi->param('POSTDATA'));
 
     use Data::Dumper;
-    print STDERR Dumper($data);
-
     my $uid = $data->{context}.'://'.$data->{uid};
 
+    my $cert = Crypt::X509->new(cert => join('', map(chr, @{$data->{pkc}->{data}})));
+
+    printf STDERR "cert subject was: %s\n", $cert->subject_cn();
+    printf STDERR "cert issuer was: %s\n", $cert->issuer_cn();
+
+
     my $ret = { valid => JSON::true,
                 message => sprintf('tried to validate "%s" through the OpenPGP Web of Trust', $uid) };
     my $status = '200 match found, authentication details to follow';
@@ -65,6 +83,5 @@ use strict;
   }
 }
 
-# start the server on port 8091
-my $server = MSVA->new(8901);
+my $server = MSVA->new();
 $server->run();

-- 
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