Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Preparing this to be a seperate package

  • Loading branch information...
commit 31cca5bba7479cd0df1c8c375c80e52522d8374d 1 parent 513e782
@singpolyma authored
Showing with 93 additions and 315 deletions.
  1. +15 −15 Makefile
  2. +4 −13 README
  3. +74 −0 openpgp-Crypto.cabal
  4. +0 −162 openpgp.cabal
  5. +0 −1  tests/data/000002-013.user_id
  6. BIN  tests/data/000003-002.sig
  7. BIN  tests/data/000004-012.ring_trust
  8. BIN  tests/data/000005-002.sig
  9. BIN  tests/data/000006-012.ring_trust
  10. BIN  tests/data/000007-002.sig
  11. BIN  tests/data/000008-012.ring_trust
  12. BIN  tests/data/000009-002.sig
  13. BIN  tests/data/000010-012.ring_trust
  14. BIN  tests/data/000011-002.sig
  15. BIN  tests/data/000012-012.ring_trust
  16. BIN  tests/data/000013-014.public_subkey
  17. BIN  tests/data/000014-002.sig
  18. BIN  tests/data/000015-012.ring_trust
  19. BIN  tests/data/000017-002.sig
  20. BIN  tests/data/000018-012.ring_trust
  21. +0 −1  tests/data/000019-013.user_id
  22. BIN  tests/data/000020-002.sig
  23. BIN  tests/data/000021-012.ring_trust
  24. BIN  tests/data/000022-002.sig
  25. BIN  tests/data/000023-012.ring_trust
  26. BIN  tests/data/000024-014.public_subkey
  27. BIN  tests/data/000025-002.sig
  28. BIN  tests/data/000026-012.ring_trust
  29. BIN  tests/data/000028-002.sig
  30. BIN  tests/data/000029-012.ring_trust
  31. +0 −1  tests/data/000030-013.user_id
  32. BIN  tests/data/000031-002.sig
  33. BIN  tests/data/000032-012.ring_trust
  34. BIN  tests/data/000033-002.sig
  35. BIN  tests/data/000034-012.ring_trust
  36. +0 −1  tests/data/000036-013.user_id
  37. BIN  tests/data/000037-002.sig
  38. BIN  tests/data/000038-012.ring_trust
  39. BIN  tests/data/000039-002.sig
  40. BIN  tests/data/000040-012.ring_trust
  41. BIN  tests/data/000041-017.attribute
  42. BIN  tests/data/000042-002.sig
  43. BIN  tests/data/000043-012.ring_trust
  44. BIN  tests/data/000044-014.public_subkey
  45. BIN  tests/data/000045-002.sig
  46. BIN  tests/data/000046-012.ring_trust
  47. BIN  tests/data/000047-005.secret_key
  48. +0 −1  tests/data/000048-013.user_id
  49. BIN  tests/data/000049-002.sig
  50. BIN  tests/data/000050-012.ring_trust
  51. BIN  tests/data/000051-007.secret_subkey
  52. BIN  tests/data/000052-002.sig
  53. BIN  tests/data/000053-012.ring_trust
  54. BIN  tests/data/000054-005.secret_key
  55. BIN  tests/data/000055-002.sig
  56. BIN  tests/data/000056-012.ring_trust
  57. +0 −1  tests/data/000057-013.user_id
  58. BIN  tests/data/000058-002.sig
  59. BIN  tests/data/000059-012.ring_trust
  60. BIN  tests/data/000060-007.secret_subkey
  61. BIN  tests/data/000061-002.sig
  62. BIN  tests/data/000062-012.ring_trust
  63. BIN  tests/data/000063-005.secret_key
  64. BIN  tests/data/000064-002.sig
  65. BIN  tests/data/000065-012.ring_trust
  66. +0 −1  tests/data/000066-013.user_id
  67. BIN  tests/data/000067-002.sig
  68. BIN  tests/data/000068-012.ring_trust
  69. BIN  tests/data/000069-005.secret_key
  70. +0 −1  tests/data/000070-013.user_id
  71. BIN  tests/data/000071-002.sig
  72. BIN  tests/data/000072-012.ring_trust
  73. BIN  tests/data/000073-017.attribute
  74. BIN  tests/data/000074-002.sig
  75. BIN  tests/data/000075-012.ring_trust
  76. BIN  tests/data/000076-007.secret_subkey
  77. BIN  tests/data/000077-002.sig
  78. BIN  tests/data/000078-012.ring_trust
  79. +0 −1  tests/data/encryption-sym-aes256.gpg
  80. BIN  tests/data/encryption-sym-cast5.gpg
  81. BIN  tests/data/encryption.gpg
  82. +0 −7 tests/data/msg1.asc
  83. BIN  tests/data/onepass_sig
  84. +0 −109 tests/suite.hs
View
30 Makefile
@@ -4,9 +4,9 @@ VERSION=0.3
.PHONY: all clean doc install debian test
-all: sign verify keygen test report.html doc dist/build/libHSopenpgp-$(VERSION).a dist/openpgp-$(VERSION).tar.gz
+all: sign verify keygen test report.html doc dist/build/libHSopenpgp-Crypto-$(VERSION).a dist/openpgp-Crypto-$(VERSION).tar.gz
-install: dist/build/libHSopenpgp-$(VERSION).a
+install: dist/build/libHSopenpgp-Crypto-$(VERSION).a
cabal install
debian: debian/control
@@ -14,46 +14,46 @@ debian: debian/control
test: tests/suite
tests/suite
-sign: examples/sign.hs Data/*.hs Data/OpenPGP/*.hs
+sign: examples/sign.hs Data/OpenPGP/Crypto.hs
ghc --make $(GHCFLAGS) -o $@ $^
-verify: examples/verify.hs Data/*.hs Data/OpenPGP/*.hs
+verify: examples/verify.hs Data/OpenPGP/Crypto.hs
ghc --make $(GHCFLAGS) -o $@ $^
-keygen: examples/keygen.hs Data/*.hs Data/OpenPGP/*.hs
+keygen: examples/keygen.hs Data/OpenPGP/Crypto.hs
ghc --make $(GHCFLAGS) -o $@ $^
-tests/suite: tests/suite.hs Data/*.hs Data/OpenPGP/*.hs
+tests/suite: tests/suite.hs Data/OpenPGP/Crypto.hs
ghc --make $(GHCFLAGS) -o $@ $^
-report.html: examples/*.hs Data/*.hs Data/OpenPGP/*.hs tests/*.hs
+report.html: examples/*.hs Data/OpenPGP/Crypto.hs tests/suite.hs
-hlint $(HLINTFLAGS) --report Data examples
-doc: dist/doc/html/openpgp/index.html README
+doc: dist/doc/html/openpgp-Crypto/index.html README
-README: openpgp.cabal
+README: openpgp-Crypto.cabal
tail -n+$$(( `grep -n ^description: $^ | head -n1 | cut -d: -f1` + 1 )) $^ > .$@
head -n+$$(( `grep -n ^$$ .$@ | head -n1 | cut -d: -f1` - 1 )) .$@ > $@
-printf ',s/ //g\n,s/^.$$//g\nw\nq\n' | ed $@
$(RM) .$@
-dist/doc/html/openpgp/index.html: dist/setup-config Data/OpenPGP.hs Data/OpenPGP/Crypto.hs
+dist/doc/html/openpgp-Crypto/index.html: dist/setup-config Data/OpenPGP/Crypto.hs
cabal haddock --hyperlink-source
-dist/setup-config: openpgp.cabal
+dist/setup-config: openpgp-Crypto.cabal
cabal configure
clean:
find -name '*.o' -o -name '*.hi' | xargs $(RM)
- $(RM) sign verify keygen tests/suite
+ $(RM) sign verify keygen tests/suite report.html
$(RM) -r dist dist-ghc
-debian/control: openpgp.cabal
+debian/control: openpgp-Crypto.cabal
cabal-debian --update-debianization
-dist/build/libHSopenpgp-$(VERSION).a: openpgp.cabal dist/setup-config Data/OpenPGP.hs Data/OpenPGP/Crypto.hs
+dist/build/libHSopenpgp-Crypto-$(VERSION).a: openpgp-Crypto.cabal dist/setup-config Data/OpenPGP/Crypto.hs
cabal build --ghc-options="$(GHCFLAGS)"
-dist/openpgp-$(VERSION).tar.gz: openpgp.cabal dist/setup-config Data/OpenPGP.hs Data/OpenPGP/Crypto.hs README
+dist/openpgp-Crypto-$(VERSION).tar.gz: openpgp-Crypto.cabal dist/setup-config Data/OpenPGP/Crypto.hs README
cabal check
cabal sdist
View
17 README
@@ -1,18 +1,9 @@
-This is an OpenPGP library inspired by my work on OpenPGP libraries in
-Ruby <https://github.com/singpolyma/openpgp>,
-PHP <http://github.com/singpolyma/openpgp-php>,
-and Python <https://github.com/singpolyma/OpenPGP-Python>.
-
-It defines types to represent OpenPGP messages as a series of packets
-and then defines instances of Data.Binary for each to facilitate
-encoding/decoding.
-
-There is also a wrapper around <http://hackage.haskell.org/package/Crypto>
+This is a wrapper around <http://hackage.haskell.org/package/Crypto>
that currently does fingerprint generation, signature generation, and
signature verification (for RSA keys only).
-It is intended that you use qualified imports with this library. If importing
-both modules, something like this will do:
+It is indended to be used with <http://hackage.haskell.org/openpgp>
+
+It is intended that you use qualified imports with this library.
-> import qualified Data.OpenPGP as OpenPGP
> import qualified Data.OpenPGP.Crypto as OpenPGP
View
74 openpgp-Crypto.cabal
@@ -0,0 +1,74 @@
+name: openpgp-Crypto
+version: 0.3
+cabal-version: >= 1.8
+license: OtherLicense
+license-file: COPYING
+category: Cryptography
+copyright: © 2011-2012 Stephen Paul Weber
+author: Stephen Paul Weber <singpolyma@singpolyma.net>
+maintainer: Stephen Paul Weber <singpolyma@singpolyma.net>
+stability: experimental
+tested-with: GHC == 7.0.3
+synopsis: Implementation of cryptography for use with OpenPGP using the Crypto library
+homepage: http://github.com/singpolyma/OpenPGP-Crypto
+bug-reports: http://github.com/singpolyma/OpenPGP-Haskell/issues
+build-type: Simple
+description:
+ This is a wrapper around <http://hackage.haskell.org/package/Crypto>
+ that currently does fingerprint generation, signature generation, and
+ signature verification (for RSA keys only).
+ .
+ It is indended to be used with <http://hackage.haskell.org/openpgp>
+ .
+ It is intended that you use qualified imports with this library.
+ .
+ > import qualified Data.OpenPGP.Crypto as OpenPGP
+
+extra-source-files:
+ README,
+ tests/suite.hs,
+ tests/data/000001-006.public_key,
+ tests/data/000016-006.public_key,
+ tests/data/000027-006.public_key,
+ tests/data/000035-006.public_key,
+ tests/data/uncompressed-ops-dsa.gpg
+ tests/data/uncompressed-ops-dsa-sha384.txt.gpg
+ tests/data/uncompressed-ops-rsa.gpg
+ tests/data/compressedsig.gpg
+ tests/data/compressedsig-zlib.gpg
+ tests/data/compressedsig-bzip2.gpg
+
+library
+ exposed-modules:
+ Data.OpenPGP.Crypto
+
+ build-depends:
+ base == 4.*,
+ containers,
+ bytestring,
+ utf8-string,
+ binary,
+ openpgp,
+ Crypto
+
+test-suite tests
+ type: exitcode-stdio-1.0
+ main-is: tests/suite.hs
+
+ build-depends:
+ base == 4.*,
+ containers,
+ bytestring,
+ utf8-string,
+ binary,
+ openpgp,
+ Crypto,
+ HUnit,
+ QuickCheck >= 2.4.1.1,
+ test-framework,
+ test-framework-hunit,
+ test-framework-quickcheck2
+
+source-repository head
+ type: git
+ location: git://github.com/singpolyma/OpenPGP-Crypto.git
View
162 openpgp.cabal
@@ -1,162 +0,0 @@
-name: openpgp
-version: 0.3
-cabal-version: >= 1.8
-license: OtherLicense
-license-file: COPYING
-category: Data
-copyright: © 2011-2012 Stephen Paul Weber
-author: Stephen Paul Weber <singpolyma@singpolyma.net>
-maintainer: Stephen Paul Weber <singpolyma@singpolyma.net>
-stability: experimental
-tested-with: GHC == 7.0.3
-synopsis: Implementation of the OpenPGP message format
-homepage: http://github.com/singpolyma/OpenPGP-Haskell
-bug-reports: http://github.com/singpolyma/OpenPGP-Haskell/issues
-build-type: Simple
-description:
- This is an OpenPGP library inspired by my work on OpenPGP libraries in
- Ruby <https://github.com/singpolyma/openpgp>,
- PHP <http://github.com/singpolyma/openpgp-php>,
- and Python <https://github.com/singpolyma/OpenPGP-Python>.
- .
- It defines types to represent OpenPGP messages as a series of packets
- and then defines instances of Data.Binary for each to facilitate
- encoding/decoding.
- .
- There is also a wrapper around <http://hackage.haskell.org/package/Crypto>
- that currently does fingerprint generation, signature generation, and
- signature verification (for RSA keys only).
- .
- It is intended that you use qualified imports with this library. If importing
- both modules, something like this will do:
- .
- > import qualified Data.OpenPGP as OpenPGP
- > import qualified Data.OpenPGP.Crypto as OpenPGP
-
-extra-source-files:
- README,
- tests/suite.hs,
- tests/data/000001-006.public_key,
- tests/data/000002-013.user_id,
- tests/data/000003-002.sig,
- tests/data/000004-012.ring_trust,
- tests/data/000005-002.sig,
- tests/data/000006-012.ring_trust,
- tests/data/000007-002.sig,
- tests/data/000008-012.ring_trust,
- tests/data/000009-002.sig,
- tests/data/000010-012.ring_trust,
- tests/data/000011-002.sig,
- tests/data/000012-012.ring_trust,
- tests/data/000013-014.public_subkey,
- tests/data/000014-002.sig,
- tests/data/000015-012.ring_trust,
- tests/data/000016-006.public_key,
- tests/data/000017-002.sig,
- tests/data/000018-012.ring_trust,
- tests/data/000019-013.user_id,
- tests/data/000020-002.sig,
- tests/data/000021-012.ring_trust,
- tests/data/000022-002.sig,
- tests/data/000023-012.ring_trust,
- tests/data/000024-014.public_subkey,
- tests/data/000025-002.sig,
- tests/data/000026-012.ring_trust,
- tests/data/000027-006.public_key,
- tests/data/000028-002.sig,
- tests/data/000029-012.ring_trust,
- tests/data/000030-013.user_id,
- tests/data/000031-002.sig,
- tests/data/000032-012.ring_trust,
- tests/data/000033-002.sig,
- tests/data/000034-012.ring_trust,
- tests/data/000035-006.public_key,
- tests/data/000036-013.user_id,
- tests/data/000037-002.sig,
- tests/data/000038-012.ring_trust,
- tests/data/000039-002.sig,
- tests/data/000040-012.ring_trust,
- tests/data/000041-017.attribute,
- tests/data/000042-002.sig,
- tests/data/000043-012.ring_trust,
- tests/data/000044-014.public_subkey,
- tests/data/000045-002.sig,
- tests/data/000046-012.ring_trust,
- tests/data/000047-005.secret_key,
- tests/data/000048-013.user_id,
- tests/data/000049-002.sig,
- tests/data/000050-012.ring_trust,
- tests/data/000051-007.secret_subkey,
- tests/data/000052-002.sig,
- tests/data/000053-012.ring_trust,
- tests/data/000054-005.secret_key,
- tests/data/000055-002.sig,
- tests/data/000056-012.ring_trust,
- tests/data/000057-013.user_id,
- tests/data/000058-002.sig,
- tests/data/000059-012.ring_trust,
- tests/data/000060-007.secret_subkey,
- tests/data/000061-002.sig,
- tests/data/000062-012.ring_trust,
- tests/data/000063-005.secret_key,
- tests/data/000064-002.sig,
- tests/data/000065-012.ring_trust,
- tests/data/000066-013.user_id,
- tests/data/000067-002.sig,
- tests/data/000068-012.ring_trust,
- tests/data/000069-005.secret_key,
- tests/data/000070-013.user_id,
- tests/data/000071-002.sig,
- tests/data/000072-012.ring_trust,
- tests/data/000073-017.attribute,
- tests/data/000074-002.sig,
- tests/data/000075-012.ring_trust,
- tests/data/000076-007.secret_subkey,
- tests/data/000077-002.sig,
- tests/data/000078-012.ring_trust,
- tests/data/pubring.gpg,
- tests/data/secring.gpg,
- tests/data/compressedsig.gpg,
- tests/data/msg1.asc,
- tests/data/uncompressed-ops-rsa.gpg,
- tests/data/uncompressed-ops-dsa.gpg,
- tests/data/uncompressed-ops-dsa-sha384.txt.gpg,
- tests/data/encryption.gpg
-
-library
- exposed-modules:
- Data.OpenPGP
- Data.OpenPGP.Crypto
-
- build-depends:
- base == 4.*,
- containers,
- bytestring,
- utf8-string,
- binary,
- zlib,
- bzlib,
- Crypto
-
-test-suite tests
- type: exitcode-stdio-1.0
- main-is: tests/suite.hs
-
- build-depends:
- base == 4.*,
- containers,
- bytestring,
- utf8-string,
- binary,
- zlib,
- bzlib,
- Crypto,
- HUnit,
- QuickCheck >= 2.4.1.1,
- test-framework,
- test-framework-hunit,
- test-framework-quickcheck2
-
-source-repository head
- type: git
- location: git://github.com/singpolyma/OpenPGP-Haskell.git
View
1  tests/data/000002-013.user_id
@@ -1 +0,0 @@
-�$Test Key (RSA) <testkey@example.org>
View
BIN  tests/data/000003-002.sig
Binary file not shown
View
BIN  tests/data/000004-012.ring_trust
Binary file not shown
View
BIN  tests/data/000005-002.sig
Binary file not shown
View
BIN  tests/data/000006-012.ring_trust
Binary file not shown
View
BIN  tests/data/000007-002.sig
Binary file not shown
View
BIN  tests/data/000008-012.ring_trust
Binary file not shown
View
BIN  tests/data/000009-002.sig
Binary file not shown
View
BIN  tests/data/000010-012.ring_trust
Binary file not shown
View
BIN  tests/data/000011-002.sig
Binary file not shown
View
BIN  tests/data/000012-012.ring_trust
Binary file not shown
View
BIN  tests/data/000013-014.public_subkey
Binary file not shown
View
BIN  tests/data/000014-002.sig
Binary file not shown
View
BIN  tests/data/000015-012.ring_trust
Binary file not shown
View
BIN  tests/data/000017-002.sig
Binary file not shown
View
BIN  tests/data/000018-012.ring_trust
Binary file not shown
View
1  tests/data/000019-013.user_id
@@ -1 +0,0 @@
-�$Test Key (DSA) <testkey@example.com>
View
BIN  tests/data/000020-002.sig
Binary file not shown
View
BIN  tests/data/000021-012.ring_trust
Binary file not shown
View
BIN  tests/data/000022-002.sig
Binary file not shown
View
BIN  tests/data/000023-012.ring_trust
Binary file not shown
View
BIN  tests/data/000024-014.public_subkey
Binary file not shown
View
BIN  tests/data/000025-002.sig
Binary file not shown
View
BIN  tests/data/000026-012.ring_trust
Binary file not shown
View
BIN  tests/data/000028-002.sig
Binary file not shown
View
BIN  tests/data/000029-012.ring_trust
Binary file not shown
View
1  tests/data/000030-013.user_id
@@ -1 +0,0 @@
-�+Test Key (DSA sign-only) <test@example.net>
View
BIN  tests/data/000031-002.sig
Binary file not shown
View
BIN  tests/data/000032-012.ring_trust
Binary file not shown
View
BIN  tests/data/000033-002.sig
Binary file not shown
View
BIN  tests/data/000034-012.ring_trust
Binary file not shown
View
1  tests/data/000036-013.user_id
@@ -1 +0,0 @@
-�.Test Key (RSA sign-only) <testkey@example.net>
View
BIN  tests/data/000037-002.sig
Binary file not shown
View
BIN  tests/data/000038-012.ring_trust
Binary file not shown
View
BIN  tests/data/000039-002.sig
Binary file not shown
View
BIN  tests/data/000040-012.ring_trust
Binary file not shown
View
BIN  tests/data/000041-017.attribute
Binary file not shown
View
BIN  tests/data/000042-002.sig
Binary file not shown
View
BIN  tests/data/000043-012.ring_trust
Binary file not shown
View
BIN  tests/data/000044-014.public_subkey
Binary file not shown
View
BIN  tests/data/000045-002.sig
Binary file not shown
View
BIN  tests/data/000046-012.ring_trust
Binary file not shown
View
BIN  tests/data/000047-005.secret_key
Binary file not shown
View
1  tests/data/000048-013.user_id
@@ -1 +0,0 @@
-�$Test Key (RSA) <testkey@example.org>
View
BIN  tests/data/000049-002.sig
Binary file not shown
View
BIN  tests/data/000050-012.ring_trust
Binary file not shown
View
BIN  tests/data/000051-007.secret_subkey
Binary file not shown
View
BIN  tests/data/000052-002.sig
Binary file not shown
View
BIN  tests/data/000053-012.ring_trust
Binary file not shown
View
BIN  tests/data/000054-005.secret_key
Binary file not shown
View
BIN  tests/data/000055-002.sig
Binary file not shown
View
BIN  tests/data/000056-012.ring_trust
Binary file not shown
View
1  tests/data/000057-013.user_id
@@ -1 +0,0 @@
-�$Test Key (DSA) <testkey@example.com>
View
BIN  tests/data/000058-002.sig
Binary file not shown
View
BIN  tests/data/000059-012.ring_trust
Binary file not shown
View
BIN  tests/data/000060-007.secret_subkey
Binary file not shown
View
BIN  tests/data/000061-002.sig
Binary file not shown
View
BIN  tests/data/000062-012.ring_trust
Binary file not shown
View
BIN  tests/data/000063-005.secret_key
Binary file not shown
View
BIN  tests/data/000064-002.sig
Binary file not shown
View
BIN  tests/data/000065-012.ring_trust
Binary file not shown
View
1  tests/data/000066-013.user_id
@@ -1 +0,0 @@
-�+Test Key (DSA sign-only) <test@example.net>
View
BIN  tests/data/000067-002.sig
Binary file not shown
View
BIN  tests/data/000068-012.ring_trust
Binary file not shown
View
BIN  tests/data/000069-005.secret_key
Binary file not shown
View
1  tests/data/000070-013.user_id
@@ -1 +0,0 @@
-�.Test Key (RSA sign-only) <testkey@example.net>
View
BIN  tests/data/000071-002.sig
Binary file not shown
View
BIN  tests/data/000072-012.ring_trust
Binary file not shown
View
BIN  tests/data/000073-017.attribute
Binary file not shown
View
BIN  tests/data/000074-002.sig
Binary file not shown
View
BIN  tests/data/000075-012.ring_trust
Binary file not shown
View
BIN  tests/data/000076-007.secret_subkey
Binary file not shown
View
BIN  tests/data/000077-002.sig
Binary file not shown
View
BIN  tests/data/000078-012.ring_trust
Binary file not shown
View
1  tests/data/encryption-sym-aes256.gpg
@@ -1 +0,0 @@
-�  ��'6*�W`�V�LE���Q�jNp(Y3��N*�?���!�M��*�*ۈ;� hL�2�+��!x�̄�&&\J{q���<16.�-�D ޿���
View
BIN  tests/data/encryption-sym-cast5.gpg
Binary file not shown
View
BIN  tests/data/encryption.gpg
Binary file not shown
View
7 tests/data/msg1.asc
@@ -1,7 +0,0 @@
------BEGIN PGP MESSAGE-----
-Version: OpenPrivacy 0.99
-
-yDgBO22WxBHv7O8X7O/jygAEzol56iUKiXmV+XmpCtmpqQUKiQrFqclFqUDBovzS
-vBSFjNSiVHsuAA==
-=njUN
------END PGP MESSAGE-----
View
BIN  tests/data/onepass_sig
Binary file not shown
View
109 tests/suite.hs
@@ -4,7 +4,6 @@ import Test.Framework.Providers.QuickCheck2
import Test.QuickCheck
import Test.HUnit hiding (Test)
-import Data.Word
import Data.Binary
import qualified Data.OpenPGP as OpenPGP
import qualified Data.OpenPGP.Crypto as OpenPGP
@@ -14,19 +13,6 @@ import qualified Data.ByteString.Lazy.UTF8 as LZ (fromString)
instance Arbitrary OpenPGP.HashAlgorithm where
arbitrary = elements [OpenPGP.MD5, OpenPGP.SHA1, OpenPGP.SHA256, OpenPGP.SHA384, OpenPGP.SHA512]
-testSerialization :: FilePath -> Assertion
-testSerialization fp = do
- bs <- LZ.readFile $ "tests/data/" ++ fp
- nullShield "First" (decode bs) (\firstpass ->
- nullShield "Second" (decode $ encode firstpass) (\secondpass ->
- assertEqual ("for " ++ fp) firstpass secondpass
- )
- )
- where
- nullShield pass (OpenPGP.Message []) _ =
- assertFailure $ pass ++ " pass of " ++ fp ++ " decoded to nothing."
- nullShield _ m f = f m
-
testFingerprint :: FilePath -> String -> Assertion
testFingerprint fp kf = do
bs <- LZ.readFile $ "tests/data/" ++ fp
@@ -53,101 +39,9 @@ prop_sign_and_verify secring kid halgo filename msg =
in
OpenPGP.verify secring (OpenPGP.Message [m,sig]) 0
-prop_s2k_count :: Word8 -> Bool
-prop_s2k_count c =
- c == OpenPGP.encode_s2k_count (OpenPGP.decode_s2k_count c)
-
tests :: OpenPGP.Message -> [Test]
tests secring =
[
- testGroup "Serialization" [
- testCase "000001-006.public_key" (testSerialization "000001-006.public_key"),
- testCase "000002-013.user_id" (testSerialization "000002-013.user_id"),
- testCase "000003-002.sig" (testSerialization "000003-002.sig"),
- testCase "000004-012.ring_trust" (testSerialization "000004-012.ring_trust"),
- testCase "000005-002.sig" (testSerialization "000005-002.sig"),
- testCase "000006-012.ring_trust" (testSerialization "000006-012.ring_trust"),
- testCase "000007-002.sig" (testSerialization "000007-002.sig"),
- testCase "000008-012.ring_trust" (testSerialization "000008-012.ring_trust"),
- testCase "000009-002.sig" (testSerialization "000009-002.sig"),
- testCase "000010-012.ring_trust" (testSerialization "000010-012.ring_trust"),
- testCase "000011-002.sig" (testSerialization "000011-002.sig"),
- testCase "000012-012.ring_trust" (testSerialization "000012-012.ring_trust"),
- testCase "000013-014.public_subkey" (testSerialization "000013-014.public_subkey"),
- testCase "000014-002.sig" (testSerialization "000014-002.sig"),
- testCase "000015-012.ring_trust" (testSerialization "000015-012.ring_trust"),
- testCase "000016-006.public_key" (testSerialization "000016-006.public_key"),
- testCase "000017-002.sig" (testSerialization "000017-002.sig"),
- testCase "000018-012.ring_trust" (testSerialization "000018-012.ring_trust"),
- testCase "000019-013.user_id" (testSerialization "000019-013.user_id"),
- testCase "000020-002.sig" (testSerialization "000020-002.sig"),
- testCase "000021-012.ring_trust" (testSerialization "000021-012.ring_trust"),
- testCase "000022-002.sig" (testSerialization "000022-002.sig"),
- testCase "000023-012.ring_trust" (testSerialization "000023-012.ring_trust"),
- testCase "000024-014.public_subkey" (testSerialization "000024-014.public_subkey"),
- testCase "000025-002.sig" (testSerialization "000025-002.sig"),
- testCase "000026-012.ring_trust" (testSerialization "000026-012.ring_trust"),
- testCase "000027-006.public_key" (testSerialization "000027-006.public_key"),
- testCase "000028-002.sig" (testSerialization "000028-002.sig"),
- testCase "000029-012.ring_trust" (testSerialization "000029-012.ring_trust"),
- testCase "000030-013.user_id" (testSerialization "000030-013.user_id"),
- testCase "000031-002.sig" (testSerialization "000031-002.sig"),
- testCase "000032-012.ring_trust" (testSerialization "000032-012.ring_trust"),
- testCase "000033-002.sig" (testSerialization "000033-002.sig"),
- testCase "000034-012.ring_trust" (testSerialization "000034-012.ring_trust"),
- testCase "000035-006.public_key" (testSerialization "000035-006.public_key"),
- testCase "000036-013.user_id" (testSerialization "000036-013.user_id"),
- testCase "000037-002.sig" (testSerialization "000037-002.sig"),
- testCase "000038-012.ring_trust" (testSerialization "000038-012.ring_trust"),
- testCase "000039-002.sig" (testSerialization "000039-002.sig"),
- testCase "000040-012.ring_trust" (testSerialization "000040-012.ring_trust"),
- testCase "000041-017.attribute" (testSerialization "000041-017.attribute"),
- testCase "000042-002.sig" (testSerialization "000042-002.sig"),
- testCase "000043-012.ring_trust" (testSerialization "000043-012.ring_trust"),
- testCase "000044-014.public_subkey" (testSerialization "000044-014.public_subkey"),
- testCase "000045-002.sig" (testSerialization "000045-002.sig"),
- testCase "000046-012.ring_trust" (testSerialization "000046-012.ring_trust"),
- testCase "000047-005.secret_key" (testSerialization "000047-005.secret_key"),
- testCase "000048-013.user_id" (testSerialization "000048-013.user_id"),
- testCase "000049-002.sig" (testSerialization "000049-002.sig"),
- testCase "000050-012.ring_trust" (testSerialization "000050-012.ring_trust"),
- testCase "000051-007.secret_subkey" (testSerialization "000051-007.secret_subkey"),
- testCase "000052-002.sig" (testSerialization "000052-002.sig"),
- testCase "000053-012.ring_trust" (testSerialization "000053-012.ring_trust"),
- testCase "000054-005.secret_key" (testSerialization "000054-005.secret_key"),
- testCase "000055-002.sig" (testSerialization "000055-002.sig"),
- testCase "000056-012.ring_trust" (testSerialization "000056-012.ring_trust"),
- testCase "000057-013.user_id" (testSerialization "000057-013.user_id"),
- testCase "000058-002.sig" (testSerialization "000058-002.sig"),
- testCase "000059-012.ring_trust" (testSerialization "000059-012.ring_trust"),
- testCase "000060-007.secret_subkey" (testSerialization "000060-007.secret_subkey"),
- testCase "000061-002.sig" (testSerialization "000061-002.sig"),
- testCase "000062-012.ring_trust" (testSerialization "000062-012.ring_trust"),
- testCase "000063-005.secret_key" (testSerialization "000063-005.secret_key"),
- testCase "000064-002.sig" (testSerialization "000064-002.sig"),
- testCase "000065-012.ring_trust" (testSerialization "000065-012.ring_trust"),
- testCase "000066-013.user_id" (testSerialization "000066-013.user_id"),
- testCase "000067-002.sig" (testSerialization "000067-002.sig"),
- testCase "000068-012.ring_trust" (testSerialization "000068-012.ring_trust"),
- testCase "000069-005.secret_key" (testSerialization "000069-005.secret_key"),
- testCase "000070-013.user_id" (testSerialization "000070-013.user_id"),
- testCase "000071-002.sig" (testSerialization "000071-002.sig"),
- testCase "000072-012.ring_trust" (testSerialization "000072-012.ring_trust"),
- testCase "000073-017.attribute" (testSerialization "000073-017.attribute"),
- testCase "000074-002.sig" (testSerialization "000074-002.sig"),
- testCase "000075-012.ring_trust" (testSerialization "000075-012.ring_trust"),
- testCase "000076-007.secret_subkey" (testSerialization "000076-007.secret_subkey"),
- testCase "000077-002.sig" (testSerialization "000077-002.sig"),
- testCase "000078-012.ring_trust" (testSerialization "000078-012.ring_trust"),
- testCase "pubring.gpg" (testSerialization "pubring.gpg"),
- testCase "secring.gpg" (testSerialization "secring.gpg"),
- testCase "compressedsig.gpg" (testSerialization "compressedsig.gpg"),
- testCase "compressedsig-zlib.gpg" (testSerialization "compressedsig-zlib.gpg"),
- testCase "compressedsig-bzip2.gpg" (testSerialization "compressedsig-bzip2.gpg"),
- testCase "onepass_sig" (testSerialization "onepass_sig"),
- testCase "uncompressed-ops-dsa.gpg" (testSerialization "uncompressed-ops-dsa.gpg"),
- testCase "uncompressed-ops-rsa.gpg" (testSerialization "uncompressed-ops-rsa.gpg")
- ],
testGroup "Fingerprint" [
testCase "000001-006.public_key" (testFingerprint "000001-006.public_key" "421F28FEAAD222F856C8FFD5D4D54EA16F87040E"),
testCase "000016-006.public_key" (testFingerprint "000016-006.public_key" "AF95E4D7BAC521EE9740BED75E9F1523413262DC"),
@@ -164,9 +58,6 @@ tests secring =
],
testGroup "Signing" [
testProperty "Crypto signatures verify" (prop_sign_and_verify secring "FEF8AFA0F661C3EE")
- ],
- testGroup "S2K count" [
- testProperty "S2K count encode reverses decode" prop_s2k_count
]
]
Please sign in to comment.
Something went wrong with that request. Please try again.