Skip to content

Commit

Permalink
Import ARC4 from new location
Browse files Browse the repository at this point in the history
  • Loading branch information
Synse authored Nov 4, 2024
1 parent d6fbe0e commit 4dd9f5f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions splunksecrets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 4dd9f5f

Please sign in to comment.