#!/usr/bin/python
+import getpass as _getpass
import hashlib as _hashlib
import math as _math
import re as _re
self['symmetric-encryption-algorithm']))
self['initial-vector'] = data[offset: offset + block_size]
offset += block_size
+ ciphertext = data[offset:]
+ offset += len(ciphertext)
+ decrypted_data = self.decrypt_symmetric_encryption(data=ciphertext)
+ else:
+ decrypted_data = data[offset:key_end]
if string_to_key_usage in [0, 255]:
key_end = -2
elif string_to_key_usage == 254:
key_end = -20
else:
key_end = 0
- secret_key = data[offset:key_end]
+ secret_key = decrypted_data[:key_end]
if key_end:
- secret_key_checksum = data[key_end:]
+ secret_key_checksum = decrypted_data[key_end:]
if key_end == -2:
calculated_checksum = sum(secret_key) % 65536
else:
self['public-key-algorithm']))
return b''.join(chunks)
+ def decrypt_symmetric_encryption(self, data):
+ raise NotImplementedError('decrypt symmetric encryption')
+
def packets_from_bytes(data):
offset = 0