Skip to content

Commit

Permalink
🗓 Apr 6, 2024 6:26:41 PM
Browse files Browse the repository at this point in the history
🔧 fixes #34
  • Loading branch information
securisec committed Apr 6, 2024
1 parent 1d1ea70 commit 625be78
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions chepy/modules/encryptionencoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ def _convert_key(
if iv_format == "base64" or iv_format == "b64":
iv = base64.b64decode(iv)
if iv_format == "utf-8" or iv_format == "utf8":
iv = key.decode().encode("utf-8")
iv = iv.decode().encode("utf-8")
if iv_format == "latin-1":
iv = key.decode().encode("latin-1")
iv = iv.decode().encode("latin-1")
if iv_format == "raw":
iv = iv
else:
Expand Down
4 changes: 4 additions & 0 deletions tests/test_encryptionencoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,10 @@ def test_aes_encrypt():
.o
== b"hello"
)
assert (
Chepy('hello')
.aes_encrypt(key='supersecret!!!!!', key_format='utf8', iv='abcdefghijklmnop', iv_format='utf-8')
.to_hex().o == b'd18c2cba21d2eef40c9ed4771a9b320e')


def test_aes_decrypt():
Expand Down

0 comments on commit 625be78

Please sign in to comment.