aboutsummaryrefslogtreecommitdiffstats
path: root/test/lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2023-04-07 12:06:25 +0100
committerVsevolod Stakhov <vsevolod@rspamd.com>2023-04-07 16:39:21 +0100
commitd6c950e5f1d84789980a08fb4cc6093102a004ec (patch)
treea0be9d7f3042009a8a804cdf4a74da774cff7437 /test/lua
parent3cc92b0ddda008cbc4633a93c993a6a21af36b6d (diff)
downloadrspamd-d6c950e5f1d84789980a08fb4cc6093102a004ec.tar.gz
rspamd-d6c950e5f1d84789980a08fb4cc6093102a004ec.zip
[Test] Add unit testing
Diffstat (limited to 'test/lua')
-rw-r--r--test/lua/unit/rsa.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/lua/unit/rsa.lua b/test/lua/unit/rsa.lua
index 338f06a0f..c67a36abb 100644
--- a/test/lua/unit/rsa.lua
+++ b/test/lua/unit/rsa.lua
@@ -37,4 +37,14 @@ context("RSA signature verification test", function()
assert_not_nil(rsa_sig)
assert_true(rsa.verify_memory(rsa_key, rsa_sig, h:bin()))
end)
+
+ test("RSA keypair + sign + verify", function()
+ local sk, pk = rsa.keypair()
+ local sig = rsa.sign_memory(sk, "test")
+ assert_true(rsa.verify_memory(pk, sig, "test"))
+ assert_false(rsa.verify_memory(pk, sig, "test1"))
+ -- Overwrite
+ sk, pk = rsa.keypair()
+ assert_false(rsa.verify_memory(pk, sig, "test"))
+ end)
end)