X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=src%2Fkeytrans%2Fpem2openpgp;h=61ce00f0d1b2fe6cd1a145248a8db3ad29d575ac;hb=17b89ec0f5ff0fce733f60b6973e8fc372d7c037;hp=3d9f6f83eb34cc43fdac303891c45194d7a15bf5;hpb=c066aca91e4e9595bb0c709673dfc5a51666b4c9;p=monkeysphere.git diff --git a/src/keytrans/pem2openpgp b/src/keytrans/pem2openpgp index 3d9f6f8..61ce00f 100755 --- a/src/keytrans/pem2openpgp +++ b/src/keytrans/pem2openpgp @@ -352,7 +352,24 @@ my $hash_algo = pack('C', $digests->{sha1}); # could an environment variable (if set) override the current time, to # be able to create a standard key? If we read the key from a file # instead of stdin, should we use the creation time on the file? -my $timestamp = time(); +my $timestamp = 0; +if (defined $ENV{PEM2OPENPGP_TIMESTAMP}) { + $timestamp = ($ENV{PEM2OPENPGP_TIMESTAMP} + 0); +} else { + $timestamp = time(); +} + +my $flags = 0; +if (! defined $ENV{PEM2OPENPGP_USAGE_FLAGS}) { + $flags = $usage_flags->{authenticate}; +} else { + my @ff = split(",", $ENV{PEM2OPENPGP_USAGE_FLAGS}); + foreach $f (@ff) { + if (! defined $usage_flags->{$f}) + die "No such flag $f"; + $flags |= $usage_flags->{$f}; + } +} my $creation_time_packet = pack('CCN', 5, $subpacket_types->{sig_creation_time}, $timestamp);