From 46458c4f9ddf975513af1329cb917d2d8a6d0e7f Mon Sep 17 00:00:00 2001 From: Michał Górny Date: Wed, 24 Jan 2018 21:45:08 +0000 Subject: openpgp: Fix GnuPG use to report UTC timestamps --- gemato/cli.py | 2 +- gemato/openpgp.py | 5 +++++ tests/test_openpgp.py | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/gemato/cli.py b/gemato/cli.py index 5fb6e24..4d8da16 100644 --- a/gemato/cli.py +++ b/gemato/cli.py @@ -86,7 +86,7 @@ def do_verify(args, argp): m.openpgp_signature.primary_key_fingerprint)) logging.info('- subkey: {}'.format( m.openpgp_signature.fingerprint)) - logging.info('- timestamp: {}'.format( + logging.info('- timestamp: {} UTC'.format( m.openpgp_signature.timestamp)) logging.info('Verifying {}...'.format(p)) diff --git a/gemato/openpgp.py b/gemato/openpgp.py index 42b2949..63890f0 100644 --- a/gemato/openpgp.py +++ b/gemato/openpgp.py @@ -5,6 +5,7 @@ import datetime import errno +import os import os.path import shutil import subprocess @@ -139,6 +140,10 @@ class OpenPGPSystemEnvironment(object): outf.write(out.decode('utf8')) def _spawn_gpg(self, options, stdin, env=None): + if env is None: + env = os.environ.copy() + env['TZ'] = 'UTC' + impls = ['gpg2', 'gpg'] if self._impl is not None: impls = [self._impl] diff --git a/tests/test_openpgp.py b/tests/test_openpgp.py index d373e48..4d034bb 100644 --- a/tests/test_openpgp.py +++ b/tests/test_openpgp.py @@ -212,7 +212,7 @@ mkkhTd2Auao4D2K74BePBuiZ9+eDQA== ''' KEY_FINGERPRINT = '81E12C16BD8DCD60BE180845136880E72A7B1384' -SIG_TIMESTAMP = datetime.datetime(2017, 11, 8, 10, 1, 26) +SIG_TIMESTAMP = datetime.datetime(2017, 11, 8, 9, 1, 26) def strip_openpgp(text): -- cgit v1.2.3