From 36601fd1d12270d1215f55e43fc8c075815fb638 Mon Sep 17 00:00:00 2001 From: Joe Crayne Date: Sun, 13 Oct 2019 00:02:36 -0400 Subject: Ed25519 support. --- Data/OpenPGP/Util/Verify.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Data/OpenPGP/Util/Verify.hs') diff --git a/Data/OpenPGP/Util/Verify.hs b/Data/OpenPGP/Util/Verify.hs index fd83485..5eea260 100644 --- a/Data/OpenPGP/Util/Verify.hs +++ b/Data/OpenPGP/Util/Verify.hs @@ -19,6 +19,7 @@ import Crypto.PubKey.HashDescr #endif import Data.OpenPGP.Util.Base +import Data.OpenPGP.Util.Ed25519 dsaKey :: OpenPGP.Packet -> Vincent.DSA.PublicKey @@ -43,6 +44,7 @@ verify :: verify keys over = over {OpenPGP.signatures_over = mapMaybe (uncurry $ verifyOne keys) sigs} where + sigs :: [(OpenPGP.Packet,BS.ByteString)] sigs = map (\s -> (s, toStrictBS $ encode over `LZ.append` OpenPGP.trailer s)) (OpenPGP.signatures_over over) @@ -52,6 +54,7 @@ verifyOne keys sig over = fmap (const sig) $ maybeKey >>= verification >>= guard verification = case OpenPGP.key_algorithm sig of OpenPGP.DSA -> dsaVerify OpenPGP.ECDSA -> ecdsaVerify + OpenPGP.Ed25519 -> ed25519Verify sig over alg | alg `elem` [OpenPGP.RSA,OpenPGP.RSA_S] -> rsaVerify | otherwise -> const Nothing @@ -97,4 +100,3 @@ verifyOne keys sig over = fmap (const sig) $ maybeKey >>= verification >>= guard hash_algo = OpenPGP.hash_algorithm sig maybeKey = OpenPGP.signature_issuer sig >>= find_key keys -- in trace ("maybeKey="++show (fmap OpenPGP.key_algorithm r)) r - -- cgit v1.2.3