encrypt-module: fixed str passed to function that expected bytes

This commit is contained in:
RhodeCode Admin 2023-03-08 14:56:09 +01:00
parent 158f8ca42e
commit 7486eea956

View file

@ -29,7 +29,7 @@ from Crypto.Cipher import AES
from Crypto import Random
from Crypto.Hash import HMAC, SHA256
from rhodecode.lib.utils2 import safe_str
from rhodecode.lib.str_utils import safe_bytes
class SignatureVerificationError(Exception):
@ -57,7 +57,7 @@ class AESCipher(object):
self.hmac_size = 32
self.hmac = hmac
self.key = SHA256.new(safe_str(key)).digest()
self.key = SHA256.new(safe_bytes(key)).digest()
self.hmac_key = SHA256.new(self.key).digest()
def verify_hmac_signature(self, raw_data):