diff options
author | Daniel Kahn Gillmor <dkg@fifthhorseman.net> | 2009-02-03 21:32:50 -0500 |
---|---|---|
committer | Daniel Kahn Gillmor <dkg@fifthhorseman.net> | 2009-02-03 21:32:50 -0500 |
commit | 4fcff7688ff46ed5d6f8fb013a659f8bce027226 (patch) | |
tree | 89661e77dc43411880a18c03ec3fd38857e2dbe6 /src | |
parent | d5359f4785e7235f07da0a380be747cb54094e35 (diff) |
accept environment variables to adjust the behavior of pem2openpgp
Diffstat (limited to 'src')
-rwxr-xr-x | src/keytrans/pem2openpgp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/keytrans/pem2openpgp b/src/keytrans/pem2openpgp index 3d9f6f8..0910d07 100755 --- a/src/keytrans/pem2openpgp +++ b/src/keytrans/pem2openpgp @@ -352,7 +352,21 @@ 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 = $ENV{PEM2OPENPGP_TIMESTAMP}; +if (! defined $timestamp) + $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); |