From c603fccd6f1c0819172b086aa2c155ed9256f3ab Mon Sep 17 00:00:00 2001 From: Timo Hocker Date: Mon, 9 Mar 2020 08:04:16 +0100 Subject: [PATCH] add test for aes 128 encryption --- test/encryption.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/encryption.js b/test/encryption.js index 5d54511..6a36b51 100644 --- a/test/encryption.js +++ b/test/encryption.js @@ -16,6 +16,29 @@ test ('decryption', (t) => { t.is (dec, 'foo'); }); +test ('encryption 128', (t) => { + const enc = crypto.encrypt_aes ( + 'foo', + 'bar', + crypto.encryption_mode_cbc_128, + ); + t.is (typeof enc, 'string'); +}); + +test ('decryption 128', (t) => { + const enc = crypto.encrypt_aes ( + 'foo', + 'bar', + crypto.encryption_mode_cbc_128, + ); + const dec = crypto.decrypt_aes ( + enc, + 'bar', + crypto.encryption_mode_cbc_128, + ); + t.is (dec, 'foo'); +}); + test ('fail decryption', (t) => { const enc = crypto.encrypt_aes ('foo', 'bar'); const dec = crypto.decrypt_aes (enc, 'baz');