my $context = shift;
my $peer = shift;
my $pkctype = shift;
+ my $pkcdata = shift;
- my $apd = create_apd($context, $peer, $pkctype);
+ my $apd = create_apd($context, $peer, $pkctype, $pkcdata);
my $apdjson = to_json($apd);
# get msva socket from environment
my $msvasocket = $ENV{MONKEYSPHERE_VALIDATION_AGENT_SOCKET};
- # creat the user agent
+ # create the user agent
my $ua = LWP::UserAgent->new;
my $headers = HTTP::Headers->new(
my $context = shift;
my $peer = shift;
my $pkctype = shift;
-
- my $pkcdata;
- my $pkcdataraw;
-
- # load raw pkc data from stdin
- $pkcdataraw = do {
- local $/; # slurp!
- <STDIN>;
- };
+ my $pkcdata = shift;
msvalog('debug', "context: %s\n", $context);
msvalog('debug', "peer: %s\n", $peer);
if ($pkctype eq 'x509der') {
- my $cert = Crypt::X509->new(cert => $pkcdataraw);
+ my $cert = Crypt::X509->new(cert => $pkcdata);
if ($cert->error) {
die;
};
die;
};
- # remap raw pkc data into numeric array
- my @remap = map(ord, split(//,$pkcdataraw));
-
- my %apd = (
- context => $context,
- peer => $peer,
- pkc => {
- type => $pkctype,
- data => \@remap,
- },
- );
-
- return \%apd;
+ return {
+ context => $context,
+ peer => $peer,
+ pkc => {
+ type => $pkctype,
+ # remap raw pkc data into numeric array
+ data => [map(ord, split(//,$pkcdata))],
+ },
+ };
}
1;
my $context = shift;
my $peer = shift;
my $pkctype = shift || 'x509der';
-my ($status,$ret) = Crypt::Monkeysphere::MSVA::Client->query_agent($context,$peer,$pkctype);
+
+# load raw pkc data from stdin
+my $pkcdata = do {
+ local $/; # slurp!
+ <STDIN>;
+};
+
+my ($status,$ret) = Crypt::Monkeysphere::MSVA::Client->query_agent($context,$peer,$pkctype, $pkcdata);
msvalog('info', "status: %s\n", $status);
msvalog('info', "valid: %s\n", $ret->{valid});