summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>2010-05-02 02:31:58 -0400
committerJesse Vincent <jesse@bestpractical.com>2010-05-08 16:51:00 -0400
commitd32052f5968b88a13ab8a0585566dca800c01d69 (patch)
tree31a32d0c207302fe7fe6771bdc699f8e17ebbb85 /lib
parentf5571e11eaf27b81a47aa6bf21c528a22ff64ece (diff)
take advantage of --fixed-list-mode and report timestamps at 1Hz precision instead of daily precision
Diffstat (limited to 'lib')
-rw-r--r--lib/GnuPG/Interface.pm25
-rw-r--r--lib/GnuPG/Key.pm9
-rw-r--r--lib/GnuPG/Signature.pm7
3 files changed, 30 insertions, 11 deletions
diff --git a/lib/GnuPG/Interface.pm b/lib/GnuPG/Interface.pm
index ac8b39f..a8bac99 100644
--- a/lib/GnuPG/Interface.pm
+++ b/lib/GnuPG/Interface.pm
@@ -422,17 +422,17 @@ sub get_keys {
my (
$user_id_validity, $key_length, $algo_num, $hex_key_id,
- $creation_date_string, $expiration_date_string,
+ $creation_date, $expiration_date,
$local_id, $owner_trust, $user_id_string,
$sigclass, #unused
$usage_flags,
) = @fields[ 1 .. $#fields ];
- # GnuPg 2.x uses epoch time for creation and expiration date strings.
+ # --fixed-list-mode uses epoch time for creation and expiration date strings.
# For backward compatibility, we convert them back using GMT;
- $creation_date_string = $self->_downrez_gpg2_date($creation_date_string);
- $expiration_date_string = $self->_downrez_gpg2_date($expiration_date_string);
+ my $creation_date_string = $self->_downrez_date($creation_date);
+ my $expiration_date_string = $self->_downrez_date($expiration_date);
$current_key = $current_fingerprinted_key
= $record_type eq 'pub'
@@ -445,6 +445,8 @@ sub get_keys {
hex_id => $hex_key_id,
local_id => $local_id,
owner_trust => $owner_trust,
+ creation_date => $creation_date,
+ expiration_date => $expiration_date,
creation_date_string => $creation_date_string,
expiration_date_string => $expiration_date_string,
usage_flags => $usage_flags,
@@ -459,13 +461,14 @@ sub get_keys {
elsif ( $record_type eq 'sig' ) {
my (
$algo_num, $hex_key_id,
- $signature_date_string, $user_id_string
+ $signature_date, $user_id_string
) = @fields[ 3 .. 5, 9 ];
- $signature_date_string = $self->_downrez_gpg2_date($signature_date_string);
+ my $signature_date_string = $self->_downrez_date($signature_date);
my $signature = GnuPG::Signature->new(
algo_num => $algo_num,
hex_id => $hex_key_id,
+ date => $signature_date,
date_string => $signature_date_string,
user_id_string => unescape_string($user_id_string),
);
@@ -493,20 +496,22 @@ sub get_keys {
elsif ( $record_type eq 'sub' or $record_type eq 'ssb' ) {
my (
$validity, $key_length, $algo_num, $hex_id,
- $creation_date_string, $expiration_date_string,
+ $creation_date, $expiration_date,
$local_id,
$dummy0, $dummy1, $dummy2, #unused
$usage_flags,
) = @fields[ 1 .. 11 ];
- $creation_date_string = $self->_downrez_gpg2_date($creation_date_string);
- $expiration_date_string = $self->_downrez_gpg2_date($expiration_date_string);
+ my $creation_date_string = $self->_downrez_date($creation_date);
+ my $expiration_date_string = $self->_downrez_date($expiration_date);
$current_signed_item = $current_fingerprinted_key
= GnuPG::SubKey->new(
validity => $validity,
length => $key_length,
algo_num => $algo_num,
hex_id => $hex_id,
+ creation_date => $creation_date,
+ expiration_date => $expiration_date,
creation_date_string => $creation_date_string,
expiration_date_string => $expiration_date_string,
local_id => $local_id,
@@ -530,7 +535,7 @@ sub get_keys {
return @returned_keys;
}
-sub _downrez_gpg2_date {
+sub _downrez_date {
my $self = shift;
my $date = shift;
if ($date =~ /^\d+$/) {
diff --git a/lib/GnuPG/Key.pm b/lib/GnuPG/Key.pm
index 54f116d..d3fc5e1 100644
--- a/lib/GnuPG/Key.pm
+++ b/lib/GnuPG/Key.pm
@@ -22,6 +22,8 @@ has [
algo_num
hex_id
hex_data
+ creation_date
+ expiration_date
creation_date_string
expiration_date_string
fingerprint
@@ -122,6 +124,13 @@ the short hex id, which is 8 hex characters.
Formatted date of the key's creation and expiration.
+=item creation_date
+
+=item expiration_date
+
+Date of the key's creation and expiration, stored as the number of
+seconds since midnight 1970-01-01 UTC.
+
=item fingerprint
A GnuPG::Fingerprint object.
diff --git a/lib/GnuPG/Signature.pm b/lib/GnuPG/Signature.pm
index f492aec..fb1dd95 100644
--- a/lib/GnuPG/Signature.pm
+++ b/lib/GnuPG/Signature.pm
@@ -16,7 +16,7 @@
package GnuPG::Signature;
use Any::Moose;
-has [qw( algo_num hex_id user_id_string date_string )] => (
+has [qw( algo_num hex_id user_id_string date date_string )] => (
isa => 'Any',
is => 'rw',
);
@@ -74,6 +74,11 @@ This may not be defined if the signing key is not on the local keyring.
The formatted date the signature was performed on.
+=item date
+
+The date the signature was performed, represented as the number of
+seconds since midnight 1970-01-01 UTC.
+
=back
=head1 SEE ALSO