-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0338122
commit 0dc8305
Showing
2 changed files
with
13 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,22 @@ | ||
from admyral.utils.crypto import encrypt_aes256_gcm, decrypt_aes256_gcm, _generate_hs256 | ||
|
||
|
||
TEST_SECRET = bytes.fromhex("834f01cf391c972f1e6def3d7f315f8194bb10048e5cf282aa4cba63b239d8fb") | ||
TEST_SECRET = bytes.fromhex( | ||
"834f01cf391c972f1e6def3d7f315f8194bb10048e5cf282aa4cba63b239d8fb" | ||
) | ||
|
||
|
||
def test_encrypt_decrypt(): | ||
msg = "this is my encrypted message - hello world!" | ||
ciphertext = encrypt_aes256_gcm(TEST_SECRET, "this is my encrypted message - hello world!") | ||
ciphertext = encrypt_aes256_gcm( | ||
TEST_SECRET, "this is my encrypted message - hello world!" | ||
) | ||
deciphered = decrypt_aes256_gcm(TEST_SECRET, ciphertext) | ||
assert deciphered == msg | ||
|
||
|
||
def test_hs256(): | ||
h = _generate_hs256(TEST_SECRET, "this is my securely hashed message - hello world!") | ||
h = _generate_hs256( | ||
TEST_SECRET, "this is my securely hashed message - hello world!" | ||
) | ||
assert h is not None |