Skip to content

Commit

Permalink
Merge pull request #18 from Synse/arc4-dep
Browse files Browse the repository at this point in the history
Resolve ARC4 `CryptographyDeprecationWarning`
  • Loading branch information
cschmidt0121 authored Nov 8, 2024
2 parents 67c15bb + 4dd9f5f commit 1518151
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
long_description=long_description,
install_requires=[
"click>=8.0.0",
"cryptography>=3.2",
"cryptography>=43",
"pcrypt",
"six>=1.12.0"
],
Expand Down
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 1518151

Please sign in to comment.