aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2022-07-11 14:08:55 +0100
committerMatthew Wild <mwild1@gmail.com>2022-07-11 14:08:55 +0100
commit2db2476824b14ee17f28d0427f8e3b56a5b77a5c (patch)
treeb34fb26e380f716330e93a996871e88c62c3fca0 /util
parente2f61d6e7e2b5862811e22fd7eb065e5997e24e0 (diff)
downloadprosody-2db2476824b14ee17f28d0427f8e3b56a5b77a5c.tar.gz
prosody-2db2476824b14ee17f28d0427f8e3b56a5b77a5c.zip
util.paseto: Error early on invalid keys
Diffstat (limited to 'util')
-rw-r--r--util/paseto.lua2
1 files changed, 2 insertions, 0 deletions
diff --git a/util/paseto.lua b/util/paseto.lua
index 352c9df0..c658902c 100644
--- a/util/paseto.lua
+++ b/util/paseto.lua
@@ -106,6 +106,7 @@ end
function v4_public.import_public_key(pem)
local key = crypto.import_public_pem(pem);
+ assert(key:get_type() == "ED25519", "Invalid public key type for v4.public");
return setmetatable({
key = key;
}, v4_public_pubkey_mt);
@@ -113,6 +114,7 @@ end
function v4_public.import_private_key(pem)
local key = crypto.import_private_pem(pem);
+ assert(key:get_type() == "ED25519", "Invalid private key type for v4.public");
return setmetatable({
key = key;
}, v4_public_privkey_mt);