summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorStephen Paul Weber <singpolyma@singpolyma.net>2012-04-24 17:51:02 -0500
committerStephen Paul Weber <singpolyma@singpolyma.net>2012-04-24 17:51:02 -0500
commitecc7c859118e022b1f3d8fff5b74702d4c0bab71 (patch)
tree29b2d117da8c39adbd52b8f86a09da0dad09c2ac /tests
parent4df371631b16d753dd262171ec82c3ebaea42a10 (diff)
Some fixes for signature verification
Diffstat (limited to 'tests')
-rw-r--r--tests/suite.hs15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/suite.hs b/tests/suite.hs
index 59b9c03..d1b232c 100644
--- a/tests/suite.hs
+++ b/tests/suite.hs
@@ -29,6 +29,13 @@ testFingerprint fp kf = do
29 let (OpenPGP.Message [packet]) = decode bs 29 let (OpenPGP.Message [packet]) = decode bs
30 assertEqual ("for " ++ fp) kf (OpenPGP.fingerprint packet) 30 assertEqual ("for " ++ fp) kf (OpenPGP.fingerprint packet)
31 31
32testVerifyMessage :: FilePath -> FilePath -> Assertion
33testVerifyMessage keyring message = do
34 keys <- fmap decode $ LZ.readFile $ "tests/data/" ++ keyring
35 m <- fmap decode $ LZ.readFile $ "tests/data/" ++ message
36 let verification = OpenPGP.verify keys m 0
37 assertEqual (keyring ++ " for " ++ message) True verification
38
32prop_s2k_count :: Word8 -> Bool 39prop_s2k_count :: Word8 -> Bool
33prop_s2k_count c = 40prop_s2k_count c =
34 c == OpenPGP.encode_s2k_count (OpenPGP.decode_s2k_count c) 41 c == OpenPGP.encode_s2k_count (OpenPGP.decode_s2k_count c)
@@ -130,6 +137,14 @@ tests =
130 testCase "000027-006.public_key" (testFingerprint "000027-006.public_key" "1EB20B2F5A5CC3BEAFD6E5CB7732CF988A63EA86"), 137 testCase "000027-006.public_key" (testFingerprint "000027-006.public_key" "1EB20B2F5A5CC3BEAFD6E5CB7732CF988A63EA86"),
131 testCase "000035-006.public_key" (testFingerprint "000035-006.public_key" "CB7933459F59C70DF1C3FBEEDEDC3ECF689AF56D") 138 testCase "000035-006.public_key" (testFingerprint "000035-006.public_key" "CB7933459F59C70DF1C3FBEEDEDC3ECF689AF56D")
132 ], 139 ],
140 testGroup "Message verification group" [
141 --testCase "uncompressed-ops-dsa" (testVerifyMessage "pubring.gpg" "uncompressed-ops-dsa.gpg"),
142 --testCase "uncompressed-ops-dsa-sha384" (testVerifyMessage "pubring.gpg" "uncompressed-ops-dsa-sha384.txt.gpg"),
143 testCase "uncompressed-ops-rsa" (testVerifyMessage "pubring.gpg" "uncompressed-ops-rsa.gpg"),
144 testCase "compressedsig" (testVerifyMessage "pubring.gpg" "compressedsig.gpg"),
145 testCase "compressedsig-zlib" (testVerifyMessage "pubring.gpg" "compressedsig-zlib.gpg"),
146 testCase "compressedsig-bzip2" (testVerifyMessage "pubring.gpg" "compressedsig-bzip2.gpg")
147 ],
133 testGroup "S2K count" [ 148 testGroup "S2K count" [
134 testProperty "S2K count encode reverses decode" prop_s2k_count 149 testProperty "S2K count encode reverses decode" prop_s2k_count
135 ] 150 ]