def test_decrypt_key(): msg_bytes = os.urandom(64 * 1024) cmk_key_id = get_cmk()[0] key_plain, key_ciphered = gen_data_key(cmk_key_id) key_decrypted = decrypt_data_key(key_ciphered) assert key_plain == key_decrypted assert decrypt(encrypt(msg_bytes, key_plain, need_derived=False), key_decrypted, need_derived=False) == msg_bytes
def test_encrypt_and_decrypt(): msg_bytes = os.urandom(64 * 1024) key = gen_data_key(get_cmk()[0])[0] assert decrypt(encrypt(msg_bytes, key, need_derived=False), key, need_derived=False) == msg_bytes