summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorStephen Paul Weber <singpolyma@singpolyma.net>2013-01-01 13:08:12 -0500
committerStephen Paul Weber <singpolyma@singpolyma.net>2013-01-01 13:08:12 -0500
commit9e4f996c68c3901bab4a5e1e70638c2531a85994 (patch)
tree38b7e03b2208d56e3e19652335fda7d4f327b901 /tests
parent06f96ec8d862e43d12cfb4c3ad8650395cfc662c (diff)
Proper S2K type
S2K is a seperate concept and is used in both secret key packets and SymmetricallyEncryptedSessionKey packets. It should have its own parser and thus its own type. This also cleans up the SecretKeyPacket record considerably (the many Maybe fields were a smell). SecretKeyPacket.s2k should be set to (Just $ SimpleS2K MD5) in fallback cases. symmetric_algorithm should be set to Unencrypted when s2k_useage is 0. s2k_useage itself is only needed for the different between 255 and 254 (different checksum). Round trip encode/decode tests for S2K work.
Diffstat (limited to 'tests')
-rw-r--r--tests/suite.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/suite.hs b/tests/suite.hs
index 3094214..feb5fe6 100644
--- a/tests/suite.hs
+++ b/tests/suite.hs
@@ -44,6 +44,10 @@ prop_MPI_serialization_loop :: OpenPGP.MPI -> Bool
44prop_MPI_serialization_loop mpi = 44prop_MPI_serialization_loop mpi =
45 mpi == decode' (encode mpi) 45 mpi == decode' (encode mpi)
46 46
47prop_S2K_serialization_loop :: OpenPGP.S2K -> Bool
48prop_S2K_serialization_loop s2k =
49 s2k == decode' (encode s2k)
50
47prop_SignatureSubpacket_serialization_loop :: OpenPGP.SignatureSubpacket -> Bool 51prop_SignatureSubpacket_serialization_loop :: OpenPGP.SignatureSubpacket -> Bool
48prop_SignatureSubpacket_serialization_loop packet = 52prop_SignatureSubpacket_serialization_loop packet =
49 packet == decode' (encode packet) 53 packet == decode' (encode packet)
@@ -141,6 +145,7 @@ tests =
141 testCase "uncompressed-ops-dsa-sha384.txt.gpg" (testSerialization "uncompressed-ops-dsa-sha384.txt.gpg"), 145 testCase "uncompressed-ops-dsa-sha384.txt.gpg" (testSerialization "uncompressed-ops-dsa-sha384.txt.gpg"),
142 testCase "uncompressed-ops-rsa.gpg" (testSerialization "uncompressed-ops-rsa.gpg"), 146 testCase "uncompressed-ops-rsa.gpg" (testSerialization "uncompressed-ops-rsa.gpg"),
143 testProperty "MPI encode/decode" prop_MPI_serialization_loop, 147 testProperty "MPI encode/decode" prop_MPI_serialization_loop,
148 testProperty "S2K encode/decode" prop_S2K_serialization_loop,
144 testProperty "SignatureSubpacket encode/decode" prop_SignatureSubpacket_serialization_loop 149 testProperty "SignatureSubpacket encode/decode" prop_SignatureSubpacket_serialization_loop
145 ], 150 ],
146 testGroup "S2K count" [ 151 testGroup "S2K count" [