diff options
Diffstat (limited to 'Data/OpenPGP/Util/Verify.hs')
-rw-r--r-- | Data/OpenPGP/Util/Verify.hs | 4 |
1 files changed, 3 insertions, 1 deletions
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 | |||
19 | #endif | 19 | #endif |
20 | 20 | ||
21 | import Data.OpenPGP.Util.Base | 21 | import Data.OpenPGP.Util.Base |
22 | import Data.OpenPGP.Util.Ed25519 | ||
22 | 23 | ||
23 | 24 | ||
24 | dsaKey :: OpenPGP.Packet -> Vincent.DSA.PublicKey | 25 | dsaKey :: OpenPGP.Packet -> Vincent.DSA.PublicKey |
@@ -43,6 +44,7 @@ verify :: | |||
43 | verify keys over = | 44 | verify keys over = |
44 | over {OpenPGP.signatures_over = mapMaybe (uncurry $ verifyOne keys) sigs} | 45 | over {OpenPGP.signatures_over = mapMaybe (uncurry $ verifyOne keys) sigs} |
45 | where | 46 | where |
47 | sigs :: [(OpenPGP.Packet,BS.ByteString)] | ||
46 | sigs = map (\s -> (s, toStrictBS $ encode over `LZ.append` OpenPGP.trailer s)) | 48 | sigs = map (\s -> (s, toStrictBS $ encode over `LZ.append` OpenPGP.trailer s)) |
47 | (OpenPGP.signatures_over over) | 49 | (OpenPGP.signatures_over over) |
48 | 50 | ||
@@ -52,6 +54,7 @@ verifyOne keys sig over = fmap (const sig) $ maybeKey >>= verification >>= guard | |||
52 | verification = case OpenPGP.key_algorithm sig of | 54 | verification = case OpenPGP.key_algorithm sig of |
53 | OpenPGP.DSA -> dsaVerify | 55 | OpenPGP.DSA -> dsaVerify |
54 | OpenPGP.ECDSA -> ecdsaVerify | 56 | OpenPGP.ECDSA -> ecdsaVerify |
57 | OpenPGP.Ed25519 -> ed25519Verify sig over | ||
55 | alg | alg `elem` [OpenPGP.RSA,OpenPGP.RSA_S] -> rsaVerify | 58 | alg | alg `elem` [OpenPGP.RSA,OpenPGP.RSA_S] -> rsaVerify |
56 | | otherwise -> const Nothing | 59 | | otherwise -> const Nothing |
57 | 60 | ||
@@ -97,4 +100,3 @@ verifyOne keys sig over = fmap (const sig) $ maybeKey >>= verification >>= guard | |||
97 | hash_algo = OpenPGP.hash_algorithm sig | 100 | hash_algo = OpenPGP.hash_algorithm sig |
98 | maybeKey = OpenPGP.signature_issuer sig >>= find_key keys | 101 | maybeKey = OpenPGP.signature_issuer sig >>= find_key keys |
99 | -- in trace ("maybeKey="++show (fmap OpenPGP.key_algorithm r)) r | 102 | -- in trace ("maybeKey="++show (fmap OpenPGP.key_algorithm r)) r |
100 | |||