diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2009-04-14 17:53:59 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2009-04-14 17:53:59 +0000 |
commit | 0eeedccf76bc2c7471d658552dead38ad5afbea9 (patch) | |
tree | bbf9b52d2bae817a80f29da0813928d1638a8e8f /usr.sbin/pkg_add/pkg_info | |
parent | ed3a64d9765d596b326e1d8ef28e5c975a742929 (diff) |
initial implementation of package signatures, based on x509 certificates and
smime detached signatures.
Diffstat (limited to 'usr.sbin/pkg_add/pkg_info')
-rw-r--r-- | usr.sbin/pkg_add/pkg_info | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/usr.sbin/pkg_add/pkg_info b/usr.sbin/pkg_add/pkg_info index 9fb73921426..64d2720a210 100644 --- a/usr.sbin/pkg_add/pkg_info +++ b/usr.sbin/pkg_add/pkg_info @@ -1,6 +1,6 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: pkg_info,v 1.71 2008/12/15 15:56:40 espie Exp $ +# $OpenBSD: pkg_info,v 1.72 2009/04/14 17:53:58 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -226,8 +226,8 @@ sub find_by_path } } -our ($opt_c, $opt_D, $opt_d, $opt_f, $opt_I, $opt_i, $opt_k, $opt_K, $opt_L, - $opt_m, $opt_Q, $opt_q, $opt_R, $opt_r, $opt_s, $opt_v, $opt_h, +our ($opt_c, $opt_C, $opt_D, $opt_d, $opt_f, $opt_I, $opt_i, $opt_k, $opt_K, + $opt_L, $opt_m, $opt_Q, $opt_q, $opt_R, $opt_r, $opt_s, $opt_v, $opt_h, $opt_l, $opt_a, $opt_M, $opt_U, $opt_A, $opt_S, $opt_P, $opt_t); my $terse = 0; my $exit_code = 0; @@ -305,10 +305,10 @@ sub print_info print "\n"; } my $plist; - if ($opt_f || $opt_L || $opt_s || $opt_S) { + if ($opt_f || $opt_L || $opt_s || $opt_S || $opt_C) { require OpenBSD::PackingList; - if ($opt_f || $opt_s || $opt_S) { + if ($opt_f || $opt_s || $opt_S || $opt_C) { $plist = $handle->plist; } else { $plist = $handle->plist(\&OpenBSD::PackingList::FilesOnly); @@ -322,6 +322,17 @@ sub print_info $plist->dump_file($opt_K); print "\n"; } + if ($opt_C) { + just_in_time_header($pkg, $handle ,\$done); + if ($plist->is_signed) { + + require OpenBSD::x509; + print $opt_l, "Certificate info:\n" unless $opt_q; + OpenBSD::x509::print_certificate_info($plist); + } else { + print $opt_l, "No digital signature\n" unless $opt_q; + } + } if ($opt_s) { just_in_time_header($pkg, $handle ,\$done); my $size = 0; @@ -357,12 +368,12 @@ sub print_info } } -set_usage('pkg_info [-AacDdfIiKkLMPqRrSstUv] [-F opt] [-E filename] [-e pkg-name] [-l str] [-Q query] [pkg-name] [...]'); +set_usage('pkg_info [-AacCDdfIiKkLMPqRrSstUv] [-F opt] [-E filename] [-e pkg-name] [-l str] [-Q query] [pkg-name] [...]'); my %defines; my $locked; try { - getopts('cDdfF:hIikKLmPQ:qRrsSUve:E:Ml:aAt', + getopts('cCDdfF:hIikKLmPQ:qRrsSUve:E:Ml:aAt', {'e' => sub { my $pat = shift; |