Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve ARC4 CryptographyDeprecationWarning #18

Merged
merged 2 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading