From d6fbe0e918399b828cc46654f3b7b269c7e03aa1 Mon Sep 17 00:00:00 2001 From: Matt Anderson Date: Mon, 4 Nov 2024 19:17:02 +0000 Subject: [PATCH 1/2] Require cryptography>=43 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index ec463a3..47214a2 100644 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ long_description=long_description, install_requires=[ "click>=8.0.0", - "cryptography>=3.2", + "cryptography>=43", "pcrypt", "six>=1.12.0" ], From 4dd9f5f7200737671ad0789cb6706c69faa1a6f9 Mon Sep 17 00:00:00 2001 From: Matt Anderson Date: Mon, 4 Nov 2024 19:20:16 +0000 Subject: [PATCH 2/2] Import ARC4 from new location --- splunksecrets.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/splunksecrets.py b/splunksecrets.py index e212afb..719f2a6 100644 --- a/splunksecrets.py +++ b/splunksecrets.py @@ -11,6 +11,7 @@ import pcrypt import six from cryptography.hazmat.backends import default_backend +from cryptography.hazmat.decrepit.ciphers.algorithms import ARC4 from cryptography.hazmat.primitives import hashes, serialization from cryptography.hazmat.primitives.ciphers import algorithms, Cipher, modes from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC @@ -45,7 +46,7 @@ def decrypt(secret, ciphertext, nosalt=False): raise ValueError(f"secret too short, need 16 bytes, got {len(secret)}") key = secret[:16] - algorithm = algorithms.ARC4(key) + algorithm = ARC4(key) cipher = Cipher(algorithm, mode=None, backend=default_backend()) decryptor = cipher.decryptor() plaintext = decryptor.update(ciphertext) @@ -109,7 +110,7 @@ def encrypt(secret, plaintext, nosalt=False): plaintext = b"".join([six.int2byte(c) for c in chars]) - algorithm = algorithms.ARC4(key) + algorithm = ARC4(key) cipher = Cipher(algorithm, mode=None, backend=default_backend()) encryptor = cipher.encryptor() ciphertext = encryptor.update(plaintext)