Skip to content

Commit 807ab1e

Browse files
Disabling sonar for AES.MODE_CBC
1 parent 2b9915a commit 807ab1e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

client_encryption/jwe_encryption.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ def encrypt_payload(payload, config, _params=None):
4242
cipher_text = full_cipher_text[: len(full_cipher_text) - 16]
4343
tag = full_cipher_text[-16:]
4444

45-
jwe_payload = _jwe_compact_serialize(encoded_header, params.encrypted_key_value, iv, cipher_text, tag)
45+
jwe_payload = _jwe_compact_serialize(encoded_header, params.encrypted_key_value, iv, cipher_text,
46+
tag)
4647

4748
if isinstance(json_payload, list):
4849
json_payload = {config.encrypted_value_field_name: jwe_payload}
@@ -85,7 +86,7 @@ def decrypt_payload(payload, config, _params=None):
8586
cipher_text = decode_jwe(encrypted_value[3])
8687

8788
if header['enc'] == 'A128CBC-HS256':
88-
aes = AES.new(key[16:], AES.MODE_CBC, iv)
89+
aes = AES.new(key[16:], AES.MODE_CBC, iv) # NOSONAR
8990
else:
9091
aad = json.dumps(header).encode("ascii")
9192
aes = AES.new(key, AES.MODE_GCM, iv)
@@ -109,6 +110,7 @@ def decrypt_payload(payload, config, _params=None):
109110
except (IOError, ValueError, TypeError) as e:
110111
raise EncryptionError("Payload decryption failed!", e)
111112

113+
112114
def _jwe_compact_serialize(encoded_header, encrypted_cek, iv, cipher_text, auth_tag):
113115
encoded_cipher_text = url_encode_bytes(cipher_text)
114116
encoded_auth_tag = url_encode_bytes(auth_tag)

0 commit comments

Comments
 (0)