Esempio n. 1
0
def test_encrypt_decrypt_fail_wrong_password_kdf_monkeypatch(monkeypatch):
    monkeypatch.setattr("nacl.pwhash.argon2id.kdf", fast_kdf)
    ciphertext = encrypt(b"message", b"password")
    with pytest.raises(nacl.exceptions.CryptoError):
        assert decrypt(ciphertext, b"hunter2") == b"message"
Esempio n. 2
0
def test_encrypt_decrypt_success_kdf_monkeypatch(monkeypatch):
    monkeypatch.setattr("nacl.pwhash.argon2id.kdf", fast_kdf)
    ciphertext = encrypt(b"message", b"password")
    assert decrypt(ciphertext, b"password") == b"message"
Esempio n. 3
0
def ciphertext_with_argon2():
    return encrypt(b"message", b"password")
Esempio n. 4
0
def test_encrypt_decrypt_fail_wrong_password_kdf_monkeypatch(monkeypatch):
    monkeypatch.setattr('nacl.pwhash.argon2id.kdf', fast_kdf)
    ciphertext = encrypt(b'message', b'password')
    with pytest.raises(nacl.exceptions.CryptoError):
        assert decrypt(ciphertext, b'hunter2') == b'message'
Esempio n. 5
0
def test_encrypt_decrypt_success_kdf_monkeypatch(monkeypatch):
    monkeypatch.setattr('nacl.pwhash.argon2id.kdf', fast_kdf)
    ciphertext = encrypt(b'message', b'password')
    assert decrypt(ciphertext, b'password') == b'message'
Esempio n. 6
0
def ciphertext_with_argon2():
    return encrypt(b'message', b'password')