no need to do in init

This commit is contained in:
J. Nick Koston 2024-01-26 06:24:58 -10:00
parent 8120bf0724
commit 26d1fcf208
No known key found for this signature in database

View File

@ -436,7 +436,6 @@ class KlapEncryptionSession:
self._key = self._key_derive(local_seed, remote_seed, user_hash) self._key = self._key_derive(local_seed, remote_seed, user_hash)
(self._iv, self._seq) = self._iv_derive(local_seed, remote_seed, user_hash) (self._iv, self._seq) = self._iv_derive(local_seed, remote_seed, user_hash)
self._aes = algorithms.AES(self._key) self._aes = algorithms.AES(self._key)
self._generate_cipher()
self._sig = self._sig_derive(local_seed, remote_seed, user_hash) self._sig = self._sig_derive(local_seed, remote_seed, user_hash)
def _key_derive(self, local_seed, remote_seed, user_hash): def _key_derive(self, local_seed, remote_seed, user_hash):
@ -474,7 +473,7 @@ class KlapEncryptionSession:
padded_data = padder.update(msg) + padder.finalize() padded_data = padder.update(msg) + padder.finalize()
ciphertext = encryptor.update(padded_data) + encryptor.finalize() ciphertext = encryptor.update(padded_data) + encryptor.finalize()
signature = hashlib.sha256( signature = hashlib.sha256(
self._sig + self._seq.to_bytes(4, "big", signed=True) + ciphertext self._sig + PACK_SIGNED_LONG(self._seq) + ciphertext
).digest() ).digest()
return (signature + ciphertext, self._seq) return (signature + ciphertext, self._seq)