# HG changeset patch # User Matthew Wild # Date 1657544935 -3600 # Node ID 2dbb3335cd346703975df720683f759fd959a27a # Parent b3f7c77c1f08af92f14f20541e747fc7a0e4e954 util.paseto: Error early on invalid keys diff -r b3f7c77c1f08 -r 2dbb3335cd34 util/paseto.lua --- a/util/paseto.lua Mon Jul 11 13:51:39 2022 +0100 +++ b/util/paseto.lua Mon Jul 11 14:08:55 2022 +0100 @@ -106,6 +106,7 @@ 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 @@ 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);