diff options
author | Rob Austein <sra@hactrn.net> | 2020-09-06 17:31:04 -0400 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2020-09-06 17:31:04 -0400 |
commit | 68f2f6f9c908d4f51036505b50ab42436e720143 (patch) | |
tree | 6e7bae5c07461d676ba958ffb2b45db2024863cf /cryptech_backup | |
parent | fe62a7a3bfa0829c367433659d4bdf2a2b004d77 (diff) |
Kludge cryptech_backup into working with Python 3.8
PyCrypto is past EOL and we really should move on, but not this close
to a release. Working around the deprecated time.clock function is
sick but appears to be harmless given the way that function is used in
PyCrypto's internal RNG. Would be better just to use os.urandom() but
that would be a much larger change.
In theory, PyCryptodome is a drop-in replacement for PyCrypto which
would solve this problem for us. Unfortunately, it's much less of a
drop-in than its documentation suggests, even before one gets into
Debian and pip disagreeing on what its name should be. Maybe someday,
but not today.
Diffstat (limited to 'cryptech_backup')
-rwxr-xr-x | cryptech_backup | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/cryptech_backup b/cryptech_backup index def2a31..a15c9c0 100755 --- a/cryptech_backup +++ b/cryptech_backup @@ -381,6 +381,15 @@ class SoftKEKEK(object): oid_aesKeyWrap = b"\x60\x86\x48\x01\x65\x03\x04\x01\x30" + # This is sick, but probably harmless, and lets us keep using + # PyCrypto for a little longer. + + try: + import time + time.clock + except AttributeError: + time.clock = time.process_time + def parse_EncryptedPrivateKeyInfo(self, der): from Crypto.Util.asn1 import DerObject, DerSequence, DerOctetString, DerObjectId encryptedPrivateKeyInfo = DerSequence() |