diff --git a/trezor_agent/gpg/encode.py b/trezor_agent/gpg/encode.py index a7b922a..7354cbb 100644 --- a/trezor_agent/gpg/encode.py +++ b/trezor_agent/gpg/encode.py @@ -112,6 +112,10 @@ class PublicKey(object): __str__ = __repr__ +def _time_format(t): + return time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(t)) + + class Signer(object): """Performs GPG signing operations.""" @@ -127,7 +131,7 @@ class Signer(object): log.info('%s GPG public key %s created at %s for "%s"', curve_name, self.pubkey, - util.time_format(self.pubkey.created), user_id) + _time_format(self.pubkey.created), user_id) @classmethod def from_public_key(cls, pubkey, user_id): @@ -229,7 +233,7 @@ class Signer(object): sign_time = int(time.time()) log.info('signing %d byte message at %s', - len(msg), util.time_format(sign_time)) + len(msg), _time_format(sign_time)) hashed_subpackets = [proto.subpacket_time(sign_time)] unhashed_subpackets = [ proto.subpacket(16, self.pubkey.key_id())] # issuer key id diff --git a/trezor_agent/util.py b/trezor_agent/util.py index d549f66..68229f2 100644 --- a/trezor_agent/util.py +++ b/trezor_agent/util.py @@ -137,11 +137,6 @@ def prefix_len(fmt, blob): return struct.pack(fmt, len(blob)) + blob -def time_format(t): - """Utility for consistent time formatting.""" - return time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(t)) - - def hexlify(blob): """Utility for consistent hexadecimal formatting.""" return binascii.hexlify(blob).decode('ascii').upper()