tests/openpgp: Reimplement tests in Scheme.
authorJustus Winter <justus@g10code.com>
Thu, 7 Jan 2016 16:01:45 +0000 (17:01 +0100)
committerJustus Winter <justus@g10code.com>
Fri, 17 Jun 2016 09:57:12 +0000 (11:57 +0200)
* Makefile.am: Build the test infrastructure on Windows.
* tests/openpgp/Makefile.am (required_pgms): Add gpgscm.
(TESTS_ENVIRONMENT): Make sure gpgscm and the libraries are found.
(TESTS): Replace tests with the new Scheme implementations.
* tests/openpgp/4gb-packet.scm: New file.
* tests/openpgp/README: Likewise.
* tests/openpgp/armdetach.scm: Likewise.
* tests/openpgp/armdetachm.scm: Likewise.
* tests/openpgp/armencrypt.scm: Likewise.
* tests/openpgp/armencryptp.scm: Likewise.
* tests/openpgp/armor.scm: Likewise.
* tests/openpgp/armsignencrypt.scm: Likewise.
* tests/openpgp/armsigs.scm: Likewise.
* tests/openpgp/clearsig.scm: Likewise.
* tests/openpgp/conventional-mdc.scm: Likewise.
* tests/openpgp/conventional.scm: Likewise.
* tests/openpgp/decrypt-dsa.scm: Likewise.
* tests/openpgp/decrypt.scm: Likewise.
* tests/openpgp/default-key.scm: Likewise.
* tests/openpgp/defs.scm: Likewise.
* tests/openpgp/detach.scm: Likewise.
* tests/openpgp/detachm.scm: Likewise.
* tests/openpgp/ecc.scm: Likewise.
* tests/openpgp/encrypt-dsa.scm: Likewise.
* tests/openpgp/encrypt.scm: Likewise.
* tests/openpgp/encryptp.scm: Likewise.
* tests/openpgp/finish.scm: Likewise.
* tests/openpgp/genkey1024.scm: Likewise.
* tests/openpgp/gpgtar.scm: Likewise.
* tests/openpgp/import.scm: Likewise.
* tests/openpgp/mds.scm: Likewise.
* tests/openpgp/multisig.scm: Likewise.
* tests/openpgp/run-tests.scm: Likewise.
* tests/openpgp/seat.scm: Likewise.
* tests/openpgp/setup.scm: Likewise.
* tests/openpgp/signencrypt-dsa.scm: Likewise.
* tests/openpgp/signencrypt.scm: Likewise.
* tests/openpgp/sigs-dsa.scm: Likewise.
* tests/openpgp/sigs.scm: Likewise.
* tests/openpgp/use-exact-key.scm: Likewise.
* tests/openpgp/verify.scm: Likewise.
* tests/openpgp/version.scm: Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
40 files changed:
Makefile.am
tests/openpgp/4gb-packet.scm [new file with mode: 0755]
tests/openpgp/Makefile.am
tests/openpgp/README [new file with mode: 0644]
tests/openpgp/armdetach.scm [new file with mode: 0755]
tests/openpgp/armdetachm.scm [new file with mode: 0755]
tests/openpgp/armencrypt.scm [new file with mode: 0755]
tests/openpgp/armencryptp.scm [new file with mode: 0755]
tests/openpgp/armor.scm [new file with mode: 0755]
tests/openpgp/armsignencrypt.scm [new file with mode: 0755]
tests/openpgp/armsigs.scm [new file with mode: 0755]
tests/openpgp/clearsig.scm [new file with mode: 0755]
tests/openpgp/conventional-mdc.scm [new file with mode: 0755]
tests/openpgp/conventional.scm [new file with mode: 0755]
tests/openpgp/decrypt-dsa.scm [new file with mode: 0755]
tests/openpgp/decrypt.scm [new file with mode: 0755]
tests/openpgp/default-key.scm [new file with mode: 0755]
tests/openpgp/defs.scm [new file with mode: 0644]
tests/openpgp/detach.scm [new file with mode: 0755]
tests/openpgp/detachm.scm [new file with mode: 0755]
tests/openpgp/ecc.scm [new file with mode: 0755]
tests/openpgp/encrypt-dsa.scm [new file with mode: 0755]
tests/openpgp/encrypt.scm [new file with mode: 0755]
tests/openpgp/encryptp.scm [new file with mode: 0755]
tests/openpgp/finish.scm [new file with mode: 0755]
tests/openpgp/genkey1024.scm [new file with mode: 0755]
tests/openpgp/gpgtar.scm [new file with mode: 0755]
tests/openpgp/import.scm [new file with mode: 0755]
tests/openpgp/mds.scm [new file with mode: 0755]
tests/openpgp/multisig.scm [new file with mode: 0755]
tests/openpgp/run-tests.scm [new file with mode: 0644]
tests/openpgp/seat.scm [new file with mode: 0755]
tests/openpgp/setup.scm [new file with mode: 0755]
tests/openpgp/signencrypt-dsa.scm [new file with mode: 0755]
tests/openpgp/signencrypt.scm [new file with mode: 0755]
tests/openpgp/sigs-dsa.scm [new file with mode: 0755]
tests/openpgp/sigs.scm [new file with mode: 0755]
tests/openpgp/use-exact-key.scm [new file with mode: 0755]
tests/openpgp/verify.scm [new file with mode: 0755]
tests/openpgp/version.scm [new file with mode: 0755]

index bf12302..3612854 100644 (file)
@@ -93,7 +93,7 @@ endif
 if RUN_TESTS
 tests = tests
 else
-tests =
+tests = tests/gpgscm tests/openpgp
 endif
 
 SUBDIRS = m4 common kbx \
diff --git a/tests/openpgp/4gb-packet.scm b/tests/openpgp/4gb-packet.scm
new file mode 100755 (executable)
index 0000000..8b2fcd6
--- /dev/null
@@ -0,0 +1,27 @@
+#!/usr/bin/env gpgscm
+
+;; Copyright (C) 2016 g10 Code GmbH
+;;
+;; This file is part of GnuPG.
+;;
+;; GnuPG is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; GnuPG is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+;; GnuPG through 2.1.7 would incorrect mark packets whose size is
+;; 2^32-1 as invalid and exit with status code 2.
+
+(load (with-path "defs.scm"))
+
+(if (= 0 (call `(,@GPG --list-packets ,(in-srcdir "4gb-packet.asc"))))
+  (info "Can parse 4GB packets.")
+  (error "Failed to parse 4GB packet."))
index bb1047d..f1fdad7 100644 (file)
@@ -22,7 +22,8 @@
 # Programs required before we can run these tests.
 required_pgms = ../../g10/gpg$(EXEEXT) ../../agent/gpg-agent$(EXEEXT) \
                 ../../tools/gpg-connect-agent$(EXEEXT) \
-               ../../tools/mk-tdata$(EXEEXT)
+               ../../tools/mk-tdata$(EXEEXT) \
+               ../gpgscm/gpgscm$(EXEEXT)
 
 AM_CPPFLAGS = -I$(top_srcdir)/common
 include $(top_srcdir)/am/cmacros.am
@@ -33,7 +34,11 @@ noinst_PROGRAMS = fake-pinentry
 
 fake_pinentry_SOURCES = fake-pinentry.c
 
-TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) GPG_AGENT_INFO= LC_ALL=C
+TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) GPG_AGENT_INFO= LC_ALL=C \
+       EXEEXT=$(EXEEXT) \
+       PATH=../gpgscm:$(PATH) \
+       objdir=$(shell readlink -f ../..) \
+       GPGSCM_PATH=$(top_srcdir)/tests/gpgscm:$(top_srcdir)/tests/openpgp
 
 if SQLITE3
 sqlite3_dependent_tests = tofu.test
@@ -41,24 +46,45 @@ else
 sqlite3_dependent_tests =
 endif
 
-# Note: version.test needs to be the first test to run and finish.test
+# Note: setup.scm needs to be the first test to run and finish.scm
 # the last one
-TESTS = version.test mds.test \
-       decrypt.test decrypt-dsa.test \
-       sigs.test sigs-dsa.test \
-       encrypt.test encrypt-dsa.test  \
-       seat.test clearsig.test encryptp.test detach.test \
-       armsigs.test armencrypt.test armencryptp.test \
-       signencrypt.test signencrypt-dsa.test \
-       armsignencrypt.test armdetach.test \
-       armdetachm.test detachm.test genkey1024.test \
-       conventional.test conventional-mdc.test \
-       multisig.test verify.test armor.test \
-       import.test ecc.test 4gb-packet.test \
+TESTS = setup.scm \
+       version.scm \
+       mds.scm \
+       decrypt.scm \
+       decrypt-dsa.scm \
+       sigs.scm \
+       sigs-dsa.scm \
+       encrypt.scm \
+       encrypt-dsa.scm \
+       seat.scm \
+       clearsig.scm \
+       encryptp.scm \
+       detach.scm \
+       detachm.scm \
+       armsigs.scm \
+       armencrypt.scm \
+       armencryptp.scm \
+       signencrypt.scm \
+       signencrypt-dsa.scm \
+       armsignencrypt.scm \
+       armdetach.scm \
+       armdetachm.scm \
+       genkey1024.scm \
+       conventional.scm \
+       conventional-mdc.scm \
+       multisig.scm \
+       verify.scm \
+       armor.scm \
+       import.scm \
+       ecc.scm \
+       4gb-packet.scm \
        $(sqlite3_dependent_tests) \
-       gpgtar.test use-exact-key.test default-key.test \
+       gpgtar.scm \
+       use-exact-key.scm \
+       default-key.scm \
        export.test \
-       finish.test
+       finish.scm
 
 
 TEST_FILES = pubring.asc secring.asc plain-1o.asc plain-2o.asc plain-3o.asc \
diff --git a/tests/openpgp/README b/tests/openpgp/README
new file mode 100644 (file)
index 0000000..498d5f5
--- /dev/null
@@ -0,0 +1,160 @@
+Emacs, this is an -*- org -*- file.
+
+* How to run the test suite
+** using the legacy driver
+On POSIX you can just use
+
+  $ make -C tests/openpgp check
+
+or
+
+  $ make -C tests/openpgp check TESTS="setup.scm your-test.scm finish.scm"
+
+as before.
+** using the Scheme driver
+This is a bit tricky because one needs to manually set some
+environment variables.  We should make that easier.  See discussion
+below.  From your build directory, do:
+
+  obj $ srcdir=<path to>/tests/openpgp \
+        GPGSCM_PATH=<path to>/tests/gpgscm:<path to>/tests/openpgp \
+        $(pwd)/tests/gpgscm/gpgscm [gpgscm args] \
+        run-tests.scm [test suite runner args]
+
+*** Arguments supported by the test suite runner
+The test suite runner supports four modes of operation,
+{sequential,parallel}x{isolated,shared}.  You can select the mode of
+operation using a combination of the flags --parallel, --sequential,
+--shared, and --isolated.
+
+By default the tests are run in sequential order, each one in a clean
+environment.
+
+You can specify the tests to run as positional arguments relative to
+srcdir (e.g. just 'version.scm').  By default all tests listed in
+run-tests.scm are executed.  Note that you do not have to specify
+setup.scm and finish.scm, they are executed implicitly.
+
+The test suite runner can be executed in any location that the current
+user can write to.  It will create temporary files and directories,
+but will in general clean up all of them.
+*** Discussion of the various environment variables
+**** srcdir
+Must be set to the source of the openpgp test suite.  Used to locate
+data files.
+**** GPGSCM_PATH
+Used to locate the Scheme library as well as code used by the test
+suite.
+**** BIN_PREFIX
+The test suite does not hardcode any paths to tools.  If set it is
+used to locate the tools to test, otherwise the test suite assumes to
+be run from the build directory.
+**** MKTDATA and GPG_PRESET_PASSPHRASE
+These two tools are not installed by 'make install', hence we need to
+explicitly override their position.  In fact, the location of any tool
+used by the test suite can be overridden this way.  See defs.scm.
+**** argv[0]
+run-tests.scm depends on being able to re-exec gpgscm.  It uses
+argv[0] for that.  Therefore you must use an absolute path to invoke
+gpgscm.
+* How to write tests
+gpgscm provides a number of functions to aid you in writing tests, as
+well as bindings to process management abstractions provided by GnuPG.
+For the Scheme environment provided by TinySCHEME, see the TinySCHEME
+manual that is included in tests/gpgscm/Manual.txt.
+
+For a quick start, please have a look at various tests that are
+already implemented, e.g. 'encrypt.scm'.
+** The test framework
+The functions info, error, and skip display their first argument and
+flush the output buffers.  error and skip will also terminate the
+process, signaling that the test failed or should be skipped.
+
+(for-each-p msg proc list) will display msg, and call proc with each
+element of list while displaying the progress appropriately.
+for-each-p' is similar, but accepts another callback before the 'list'
+argument to format each item.  for-each-p can be safely nested, and
+the inner progress indicator will be abbreviated using '.'.
+** Temporary files
+(lettmp <bindings> <body>) will create and delete temporary files that
+you can use in <body>.  (with-temporary-working-directory <body>) will
+create a temporary director, change to that, and clean it up after
+executing <body>).
+
+make-temporary-file will create a temporary file.  You can optionally
+provide an argument to that function that will serve as tag so you can
+distinguish the files for debugging.  remove-temporary-file will
+delete a file created using make-temporary-file.
+
+** Monadic transformer and pipe support
+Tests often perform sequential transformations on files, or connect
+processes using pipes.  To aid you in this, the test framework
+provides two monadic data structures.
+
+(Currently, the implementation mashes the 'bind' operation together
+with the application of the monad.  Also, there is no 'return'
+operation.  I guess all of that could be implemented on top of
+call/cc, but it isn't at the moment.)
+*** pipe
+The pipe monad constructs pipe lines.  It consists of a function
+pipe:do that binds the functions together and manages the execution of
+the child processes, a family of functions that act as sources, a
+function to spawn processes, and a family of functions acting as
+sinks.
+
+Sources are pipe:open, pipe:defer, pipe:echo.  To spawn a process use
+pipe:spawn, or the convenience function pipe:gpg.  To sink the data
+use pipe:splice, or pipe:write-to.
+
+Example:
+
+  (pipe:do
+    (pipe:echo "3\n1\n2\n")
+    (pipe:spawn '("/usr/bin/sort"))
+    (pipe:write-to "sorted" (logior O_WRONLY O_CREAT) #o600))
+
+Caveats: Due to the single-threaded nature of gpgscm you cannot use
+both a source and sink that is implemented in Scheme.  pipe:defer and
+pipe:echo are executing in gpgscm, and so does pipe:splice.
+*** tr
+The transformer monad describes sequential file transformations.
+
+There is one source function, tr:open.  To describe a transformation
+using some process, use tr:spawn, tr:gpg, or tr:pipe-do.  There are
+several sinks, although sink is not quite the right term, because the
+data is not consumed, and hence one can use them at any position.  The
+"sinks" are tr:write-to, tr:call-with-content, tr:assert-identity, and
+tr:assert-weak-identity.
+
+A somewhat contrived example demonstrating many functions is:
+
+  (tr:do
+    (tr:pipe-do
+      (pipe:echo "3\n1\n2\n")
+      (pipe:spawn '("/usr/bin/sort")))
+    (tr:write-to "reference")
+    (tr:call-with-content
+     (lambda (c)
+       (echo "currently, c contains" (string-length c) "bytes")))
+    (tr:spawn "" '("/usr/bin/gcc" -x c "-E" -o **out** **in**))
+    (tr:pipe-do
+      (pipe:spawn '("/bin/grep" -v "#")))
+    (tr:assert-identity "reference"))
+
+Caveats: As a convenience, gpgscm allows one to specify command line
+arguments as Scheme symbols.  Scheme symbols, however, are
+case-insensitive, and get converted to lower case.  Therefore, the -E
+argument must be given as a string in the example above.  Similarly,
+you need to quote numerical values.
+** Process management
+If you just need to execute a single command, there is (call-with-fds
+cmdline infd outfd errfd) which executes cmdline with the given file
+descriptors bound to it, and waits for its completion returning the
+status code.  There is (call cmdline) which is similar, but calls the
+command with a closed stdin, connecting stdout and stderr to stderr if
+gpgscm is executed with --verbose.  (call-check cmdline) raises an
+exception if the command does not return 0.
+
+(call-popen cmdline input) calls a command, writes input to its stdin,
+and returns any output from stdout, or raises an exception containing
+stderr on failure.
diff --git a/tests/openpgp/armdetach.scm b/tests/openpgp/armdetach.scm
new file mode 100755 (executable)
index 0000000..69e09d8
--- /dev/null
@@ -0,0 +1,31 @@
+#!/usr/bin/env gpgscm
+
+;; Copyright (C) 2016 g10 Code GmbH
+;;
+;; This file is part of GnuPG.
+;;
+;; GnuPG is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; GnuPG is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+(load (with-path "defs.scm"))
+
+(for-each-p
+ "Checking armored detached signatures"
+ (lambda (source)
+   (lettmp (tmp)
+     (call-popen `(,@GPG --yes --passphrase-fd "0" -sab
+                        --output ,tmp ,source ) usrpass1)
+     (pipe:do
+      (pipe:open source (logior O_RDONLY O_BINARY))
+      (pipe:spawn `(,@GPG --yes ,tmp)))))
+ (append plain-files data-files))
diff --git a/tests/openpgp/armdetachm.scm b/tests/openpgp/armdetachm.scm
new file mode 100755 (executable)
index 0000000..618f7aa
--- /dev/null
@@ -0,0 +1,35 @@
+#!/usr/bin/env gpgscm
+
+;; Copyright (C) 2016 g10 Code GmbH
+;;
+;; This file is part of GnuPG.
+;;
+;; GnuPG is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; GnuPG is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+(load (with-path "defs.scm"))
+
+(define files (append plain-files data-files))
+
+(info "Checking armored detached signatures of multiple files")
+(lettmp (tmp)
+  (call-popen `(,@GPG --yes --passphrase-fd "0" -sab
+                     --output ,tmp ,@files) usrpass1)
+  (pipe:do
+   (pipe:defer (lambda (sink)
+                (for-each (lambda (file)
+                            (pipe:do
+                             (pipe:open file (logior O_RDONLY O_BINARY))
+                             (pipe:splice sink)))
+                          files)))
+   (pipe:spawn `(,@GPG --yes ,tmp))))
diff --git a/tests/openpgp/armencrypt.scm b/tests/openpgp/armencrypt.scm
new file mode 100755 (executable)
index 0000000..b0cf099
--- /dev/null
@@ -0,0 +1,30 @@
+#!/usr/bin/env gpgscm
+
+;; Copyright (C) 2016 g10 Code GmbH
+;;
+;; This file is part of GnuPG.
+;;
+;; GnuPG is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; GnuPG is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+(load (with-path "defs.scm"))
+
+(for-each-p
+ "Checking armored encryption"
+ (lambda (source)
+   (tr:do
+    (tr:open source)
+    (tr:gpg usrpass1 `(--yes --passphrase-fd "0" -ea --recipient ,usrname2))
+    (tr:gpg "" '(--yes))
+    (tr:assert-identity source)))
+ (append plain-files data-files))
diff --git a/tests/openpgp/armencryptp.scm b/tests/openpgp/armencryptp.scm
new file mode 100755 (executable)
index 0000000..7555ce9
--- /dev/null
@@ -0,0 +1,31 @@
+#!/usr/bin/env gpgscm
+
+;; Copyright (C) 2016 g10 Code GmbH
+;;
+;; This file is part of GnuPG.
+;;
+;; GnuPG is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; GnuPG is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+(load (with-path "defs.scm"))
+
+(for-each-p
+ "Checking armored encryption and decryption using pipes"
+ (lambda (source)
+   (tr:do
+    (tr:open source)
+    (tr:pipe-do
+     (pipe:gpg `(--yes -ea --recipient ,usrname2))
+     (pipe:gpg '(--yes)))
+    (tr:assert-identity source)))
+ (append plain-files data-files))
diff --git a/tests/openpgp/armor.scm b/tests/openpgp/armor.scm
new file mode 100755 (executable)
index 0000000..5b4ea14
--- /dev/null
@@ -0,0 +1,766 @@
+#!/usr/bin/env gpgscm
+
+;; Copyright (C) 2016 g10 Code GmbH
+;;
+;; This file is part of GnuPG.
+;;
+;; GnuPG is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; GnuPG is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+(load (with-path "defs.scm"))
+
+(define armored_key_8192 "-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: SKS 1.0.9
+
+mQGiBDnKLQkRBACVlYh6HivoRjHzGedNpnYPISxImK3eFgt+qs/DD9rqhBOSUTYvmKfa1u7M
+W4XDc23YEoq3MyhtC35IL2RH6rmeIPz7ZVK5rUKWMqzf94n58gIkgdDZgCcaDWImtZFSjji4
+TGhepaIz75iIbymvtnjr9d++fH/lFkz0HDjbOkXCfwCg9GeOjiWw1yBK8cO11acAjk+QpW8D
+/i8ftC1hV0iuh9mswYeG05pBbeeaOW4I2Ps4IcecpXhSyPaP1YiXKRqg9GX2brNgXwc3MEiq
+Wn4UU407RzjrUNF4/d20Q7N2g2MDUDzBtmMytfT2LLKlj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9TNDYmVl
+nW1ff9rt1YcTH9LiiE4EGBECAAYFAjnKLe0AEgkQ3uyMCd5BWw4HZUdQRwABAZeBAKDsa7tc
+7OqcRycJhHu/qu5vl3TPDACg6xD1M0NiZWWdbV9/2u3VhxMf0uI=
+=oXxa
+-----END PGP PUBLIC KEY BLOCK-----
+")
+
+;; Bug solved 2005-04-07:
+;; Try importing the attached key file.  As the key is exactly 8192
+;; bytes long, radix64_read is called twice - the first time to read
+;; the 8192 bytes, and then once again, to handle the pad '=' on the
+;; last four character radix64 block '0uI='.  gpg bails out with
+;;  gpg: [don't know]: invalid packet (ctb=2d)
+;; On a read for only the = sign, radix64_read returns -1 for EOF.
+;; This causes the iobuf code to pop the armor filter and thus the next
+;; byte read is the '-' from the END header line, causing an error.
+(info "Checking armored_key_8192")
+(pipe:do
+ (pipe:echo armored_key_8192)
+ (pipe:gpg '(--import)))
+
+(define nopad_armored_msg "-----BEGIN PGP MESSAGE-----
+Version: GnuPG v1.4.11-svn5139 (GNU/Linux)
+
+hQEOA2rm1+5GqHH4EAQAi8xXorNRK4QSZR1os2xtbVeZg5pI0hrdyejn0jSnlWmw
+wqnhQnoOXsX/ZE8Sq0deOJDKhIJztVcu4QB17R0zRxXhN+huXq/DRGUa3X2xF+Po
+4bP1XsZT6jYc6RDiN8KzQkuUgEjGsQhEYzBMFgk+tFDDA6PYKRk2mn0UaTyR6NUD
+/jimx1teliNBMhrPQjbBMCdgczfUhH0srGFKovkduf+Fmn0v4rV3JAhtHPYaPrgY
+hQtCMdjgCdh3uMK6rbprGdQ2lh4PAFKd25djBJlf8KBqkJXimAYhe5Y1q/x58xbA
+R5/tAKZFKT+ooU9qjVzXA0APHBwV50/K76Rsxo0QQOTihQEMA7WIRff0Cc1UAQf+
+MZ5HWEX6+2teJWGVKMmJBFkYF4rAEIoqEmtzRWcsAPx6PFXQt5Ok3PbSGDgOsQTQ
+XwR5bEmZ6Gd/O2xIM4BnwKQ/g6PxksPuni0ajZS5YWdoGY7ZTS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hbGZhQGV4YW1wbGUubmV0PohVBBMRAgAV
+BQI247hYAwsKAwMVAwIDFgIBAheAAAoJEC1yfMdoaXc0t8IAoJPwa6j+Vm5Vi3Nv
+uo8JZri4PJ/DAJ9dqbmaJdB8FdJnHfGh1rXK3y/Jcp0BuAQ2448PEAQAnI3XH1f0
+uyN9fZnw72zsHMw706g7EW29nD4UDQG4OzRZViSrUa5n39eI7QrfTO+1meVvs0y8
+F/PvFst5jH68rPLnGSrXz4sTl1T4cop1FBkquvCAKwPLy0lE7jjtCyItOSwIOo8x
+oTfY4JEEXmcqsbm+KHv9yYSF/YK4Cf7bIzcAAwcD/Rnl5jKxoucDA96pD2829TKs
+LFQSau+Xiy8bvOSSDdlyABsOkNBSaeKO3eAQEKgDM7dzjVNTnAlpQ0EQ8Y9Z8pxO
+WYEQYlaMrnRBC4DZ2IadzEhLlIOz5BVp/jfhrr8oVVBwKZXsrz9PZLz+e4Yn+siU
+Uvlei9boD9L2ZgSOHakP/gIDApwXVB6n49+yw6e5k2VJBGTFDkQbxpgi4oslePpT
+7Tc2qjAke4zO8JHkgKSokEgnMpMz412q9otFX/3qC5MpPG5P8f4r00Kfy9Am/thk
+ri01WTIUqF8L/VZXJxLKVoRAabSXudG0eavfah14fN5/+Bw5i8vSHhc/xmQEKTya
+2X8Nt1F5zMrE1LAGVVCL9i/DUygnJYOZzAd1Ct0RJ4kFj7lOBICF2IWWiEYEGBEC
+AAYFAjbjjw8ACgkQLXJ8x2hpdzQgqQCgn81AaW8W/lyVwMh/UBeMuVMUb24An2uz
+wg7Md81a5RI3F2FG8747t9gX
+=VM1e
+-----END PGP PRIVATE KEY BLOCK-----
+")
+
+;; Bug 1179 solved 2010-05-12:
+;; It occured for messages of a multiple of the iobuf block size where
+;; the last line had no pad character.  Due to premature poppng of thea
+;; rmor filter gpg swalled the CRC line and passed the '-----END...'
+;; line on to the decryption layer.
+
+(info "Importing alpha_seckey")
+(pipe:do
+ (pipe:echo alpha_seckey)
+ (pipe:gpg '(--import)))
+
+(info "Checking for bug #1179")
+(tr:do
+ (tr:pipe-do
+  (pipe:echo nopad_armored_msg)
+  (pipe:gpg '())))
diff --git a/tests/openpgp/armsignencrypt.scm b/tests/openpgp/armsignencrypt.scm
new file mode 100755 (executable)
index 0000000..b84bfe4
--- /dev/null
@@ -0,0 +1,30 @@
+#!/usr/bin/env gpgscm
+
+;; Copyright (C) 2016 g10 Code GmbH
+;;
+;; This file is part of GnuPG.
+;;
+;; GnuPG is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; GnuPG is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+(load (with-path "defs.scm"))
+
+(for-each-p
+ "Checking armored signing and encryption"
+ (lambda (source)
+   (tr:do
+    (tr:open source)
+    (tr:gpg usrpass1 `(--yes --passphrase-fd "0" -sea --recipient ,usrname2))
+    (tr:gpg "" '(--yes))
+    (tr:assert-identity source)))
+ (append plain-files data-files))
diff --git a/tests/openpgp/armsigs.scm b/tests/openpgp/armsigs.scm
new file mode 100755 (executable)
index 0000000..d897581
--- /dev/null
@@ -0,0 +1,30 @@
+#!/usr/bin/env gpgscm
+
+;; Copyright (C) 2016 g10 Code GmbH
+;;
+;; This file is part of GnuPG.
+;;
+;; GnuPG is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; GnuPG is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+(load (with-path "defs.scm"))
+
+(for-each-p
+ "Checking armored signatures"
+ (lambda (source)
+   (tr:do
+    (tr:open source)
+    (tr:gpg usrpass1 `(--yes --passphrase-fd "0" -sa --recipient ,usrname2))
+    (tr:gpg "" '(--yes))
+    (tr:assert-identity source)))
+ (append plain-files data-files))
diff --git a/tests/openpgp/clearsig.scm b/tests/openpgp/clearsig.scm
new file mode 100755 (executable)
index 0000000..96b1b4c
--- /dev/null
@@ -0,0 +1,107 @@
+#!/usr/bin/env gpgscm
+
+;; Copyright (C) 2016 g10 Code GmbH
+;;
+;; This file is part of GnuPG.
+;;
+;; GnuPG is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; GnuPG is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+(load (with-path "defs.scm"))
+
+(define (check-signing args input)
+  (lambda (source sink)
+    (lettmp (signed)
+           (call-popen `(,@GPG --output ,signed --yes
+                               ,@args ,source) input)
+           (call-popen `(,@GPG --output ,sink --yes ,signed) ""))))
+
+(for-each-p
+ "Checking signing and verifying plain text messages"
+ (lambda (source)
+   ((if (equal? "plain-3" source)
+       ;; plain-3 does not end in a newline, and gpg will add one.
+       ;; Therefore, we merely check that the verification is ok.
+       check-execution
+       ;; Otherwise, we do check that we recover the original file.
+       check-identity)
+    source
+    (check-signing '(--passphrase-fd "0" --clearsign) usrpass1)))
+ (append plain-files '("plain-large")))
+
+;; The test vectors are lists of length three, containing
+;; - a string to be signed,
+;; - a flag indicating whether we verify that the exact message is
+;;   reconstructed (whitespace at the end is normalized for plain text
+;;   messages),
+;; - and a list of arguments to add to gpg when encoding
+;;   the string.
+
+(define :string car)
+(define :check-equality cadr)
+(define :options caddr)
+
+(define
+  vectors
+  '(;; one with long lines
+    ("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxyx
+
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+" #t ())
+
+    ;; one with only one long line
+    ("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxyx
+" #t ())
+
+    ;; and one with an empty body
+    ("" #f ())
+
+    ;; and one with one empty line at the end
+    ("line 1
+line 2
+line 3
+there is a blank line after this
+
+" #t ())
+
+    ;; I think this file will be constructed wrong (gpg 0.9.3) but it
+    ;; should verify okay anyway.
+    ("this is a sig test
+ " #f ())
+
+    ;; check our special diff mode
+    ("--- mainproc.c   Tue Jun 27 09:28:11 2000
++++ mainproc.c~ Thu Jun  8 22:50:25 2000
+@@ -1190,16 +1190,13 @@
+               md_enable( c->mfx.md, n1->pkt->pkt.signature->digest_algo);
+           }
+           /* ask for file and hash it */
+-          if( c->sigs_only ) {
++          if( c->sigs_only )
+               rc = hash_datafiles( c->mfx.md, NULL,
+                                    c->signed_data, c->sigfilename,
+                       n1? (n1->pkt->pkt.onepass_sig->sig_class == 0x01):0 );
+" #t (--not-dash-escaped))))
+
+(let ((counter (make-counter)))
+  (for-each-p'
+   "Checking signing and verifying test vectors"
+   (lambda (vec)
+     (lettmp (tmp)
+       (with-output-to-file tmp (lambda () (display (:string vec))))
+       ((if (:check-equality vec) check-identity check-execution)
+       tmp
+       (check-signing `(--passphrase-fd "0" --clearsign ,@(:options vec))
+                      usrpass1))))
+   (lambda (vec) (counter))
+   vectors))
diff --git a/tests/openpgp/conventional-mdc.scm b/tests/openpgp/conventional-mdc.scm
new file mode 100755 (executable)
index 0000000..c524921
--- /dev/null
@@ -0,0 +1,65 @@
+#!/usr/bin/env gpgscm
+
+;; Copyright (C) 2016 g10 Code GmbH
+;;
+;; This file is part of GnuPG.
+;;
+;; GnuPG is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; GnuPG is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+(load (with-path "defs.scm"))
+
+(define s2k '--s2k-count=65536)
+(define passphrase "Hier spricht HAL")
+
+(define (file-copy-n from to n)
+  (catch '() (unlink to))
+  (letfd ((source (open from (logior O_RDONLY O_BINARY)))
+         (sink (open to (logior O_WRONLY O_CREAT O_BINARY) #o600)))
+    (splice source sink n)))
+
+(define test-files
+  (map (lambda (size)
+        (let ((tmp (make-temporary-file
+                    (string-append "data-80000-" (number->string size)))))
+          (file-copy-n "data-80000" tmp size)
+          tmp))
+       '(0 1 2 3 9 10 11 19 20 21 22 23 39 40 41 8192 32000)))
+
+(for-each-p
+ "Checking conventional encryption with MDC"
+ (lambda (algo)
+   (for-each-p
+    ""
+    (lambda (source)
+      (tr:do
+       (tr:open source)
+       (tr:gpg passphrase `(--yes --passphrase-fd "0" ,s2k
+                                 --force-mdc -c
+                                 --cipher-algo ,algo))
+       (tr:gpg passphrase `(--yes --passphrase-fd "0" ,s2k))
+       (tr:assert-identity source)))
+    test-files))
+ all-cipher-algos)
+
+(for-each remove-temporary-file test-files)
+
+(for-each-p
+ "Checking sign+symencrypt"
+ (lambda (source)
+   (tr:do
+    (tr:open source)
+     (tr:gpg passphrase `(--yes --passphrase-fd "0" ,s2k -cs))
+     (tr:gpg passphrase `(--yes --passphrase-fd "0" ,s2k))
+     (tr:assert-identity source)))
+ (append plain-files data-files))
diff --git a/tests/openpgp/conventional.scm b/tests/openpgp/conventional.scm
new file mode 100755 (executable)
index 0000000..67e28e2
--- /dev/null
@@ -0,0 +1,48 @@
+#!/usr/bin/env gpgscm
+
+;; Copyright (C) 2016 g10 Code GmbH
+;;
+;; This file is part of GnuPG.
+;;
+;; GnuPG is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; GnuPG is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+(load (with-path "defs.scm"))
+
+(define s2k '--s2k-count=65536)
+(define passphrase "Hier spricht HAL")
+
+(for-each-p
+ "Checking conventional encryption"
+ (lambda (source)
+   (tr:do
+    (tr:open source)
+     (tr:gpg passphrase `(--yes --passphrase-fd "0" ,s2k -c))
+     (tr:gpg passphrase `(--yes --passphrase-fd "0" ,s2k))
+     (tr:assert-identity source)))
+ '("plain-2" "data-32000"))
+
+(for-each-p
+ "Checking conventional encryption using a specific cipher"
+ (lambda (algo)
+   (for-each-p
+    ""
+    (lambda (source)
+      (tr:do
+       (tr:open source)
+       (tr:gpg passphrase `(--yes --passphrase-fd "0" ,s2k -c
+                                 --cipher-algo ,algo))
+       (tr:gpg passphrase `(--yes --passphrase-fd "0" ,s2k))
+       (tr:assert-identity source)))
+    '("plain-1" "data-80000")))
+ all-cipher-algos)
diff --git a/tests/openpgp/decrypt-dsa.scm b/tests/openpgp/decrypt-dsa.scm
new file mode 100755 (executable)
index 0000000..b01a0f7
--- /dev/null
@@ -0,0 +1,29 @@
+#!/usr/bin/env gpgscm
+
+;; Copyright (C) 2016 g10 Code GmbH
+;;
+;; This file is part of GnuPG.
+;;
+;; GnuPG is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; GnuPG is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+(load (with-path "defs.scm"))
+
+(for-each-p
+ "Checking decryption of supplied DSA encrypted file"
+ (lambda (name)
+   (tr:do
+    (tr:open (in-srcdir (string-append name "-pgp.asc")))
+    (tr:gpg "" '(--yes))
+    (tr:assert-identity name)))
+ (list (car plain-files)))
diff --git a/tests/openpgp/decrypt.scm b/tests/openpgp/decrypt.scm
new file mode 100755 (executable)
index 0000000..ec0f8e7
--- /dev/null
@@ -0,0 +1,29 @@
+#!/usr/bin/env gpgscm
+
+;; Copyright (C) 2016 g10 Code GmbH
+;;
+;; This file is part of GnuPG.
+;;
+;; GnuPG is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; GnuPG is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+(load (with-path "defs.scm"))
+
+(for-each-p
+ "Checking decryption of supplied files"
+ (lambda (name)
+   (tr:do
+    (tr:open (in-srcdir (string-append name ".asc")))
+    (tr:gpg "" '(--yes))
+    (tr:assert-identity name)))
+ plain-files)
diff --git a/tests/openpgp/default-key.scm b/tests/openpgp/default-key.scm
new file mode 100755 (executable)
index 0000000..4433658
--- /dev/null
@@ -0,0 +1,76 @@
+#!/usr/bin/env gpgscm
+
+;; Copyright (C) 2016 g10 Code GmbH
+;;
+;; This file is part of GnuPG.
+;;
+;; GnuPG is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; GnuPG is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+(load (with-path "defs.scm"))
+
+;; Import the sample key
+;;
+;; pub   1024R/8BC90111 2015-12-02
+;;       Key fingerprint = E657 FB60 7BB4 F21C 90BB  6651 BC06 7AF2 8BC9 0111
+;; uid       [ultimate] Barrett Brown <barrett@example.org>
+;; sub   1024R/3E880CFF 2015-12-02 (encryption)
+;; sub   1024R/F5F77B83 2015-12-02 (signing)
+;; sub   1024R/45117079 2015-12-02 (encryption)
+;; sub   1024R/1EA97479 2015-12-02 (signing)
+
+(info "Importing public key.")
+(call-check
+ `(,(tool 'gpg) --import
+   ,(in-srcdir "samplekeys/E657FB607BB4F21C90BB6651BC067AF28BC90111.asc")))
+
+;; By default, the most recent, valid signing subkey (1EA97479).
+(for-each-p
+ "Checking that the most recent, valid signing subkey is used by default"
+ (lambda (keyid)
+   (tr:do
+     (tr:pipe-do
+      (pipe:defer (lambda (sink) (display "" (fdopen sink "w"))))
+      (pipe:gpg `(--default-key ,keyid -s))
+      (pipe:gpg '(--verify --status-fd=1)))
+     (tr:call-with-content
+      (lambda (c)
+       (unless (string-contains?
+                c "VALIDSIG 5FBA84ACE02DCB17DA3DFF6BBCA43C441EA97479")
+           (exit 1))))))
+ '("8BC90111" "3E880CFF" "F5F77B83" "45117079" "1EA97479"))
+
+;; But, if we request a particular signing key, we should get it.
+(for-each-p
+ "Checking that the most recent, valid encryption subkey is used by default"
+ (lambda (keyid)
+   (tr:do
+     (tr:pipe-do
+      (pipe:defer (lambda (sink) (display "" (fdopen sink "w"))))
+      ;; We need another recipient, because --encrypt-to-default-key is
+      ;; not considered a recipient and gpg doesn't encrypt without any
+      ;; recipients.
+      ;;
+      ;; Note: it doesn't matter whether we specify the primary key or
+      ;; a subkey: the newest encryption subkey will be used.
+      (pipe:gpg `(--default-key ,keyid --encrypt-to-default-key
+                               -r "439F02CA" -e))
+      (pipe:gpg '(--list-packets)))
+     (tr:call-with-content
+      (lambda (c)
+       (unless (any (lambda (line)
+                      (and (string-prefix? line ":pubkey enc packet:")
+                           (string-suffix? line "45117079")))
+                    (string-split c #\newline))
+           (exit 1))))))
+ '("8BC90111" "3E880CFF" "F5F77B83" "45117079" "1EA97479"))
diff --git a/tests/openpgp/defs.scm b/tests/openpgp/defs.scm
new file mode 100644 (file)
index 0000000..6fdb955
--- /dev/null
@@ -0,0 +1,130 @@
+;; Common definitions for the OpenPGP test scripts.
+;;
+;; Copyright (C) 2016 g10 Code GmbH
+;;
+;; This file is part of GnuPG.
+;;
+;; GnuPG is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; GnuPG is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+;;
+;; Constants.
+;;
+
+(define usrname1 "one@example.com")
+(define usrpass1 "def")
+(define usrname2 "two@example.com")
+(define usrpass2 "")
+(define usrname3 "three@example.com")
+(define usrpass3 "")
+
+(define dsa-usrname1 "pgp5")
+;; we use the sub key because we do not yet have the logic to to derive
+;; the first encryption key from a keyblock (I guess) (Well of course
+;; we have this by now and the notation below will lookup the primary
+;; first and then search for the encryption subkey.)
+(define dsa-usrname2 "0xCB879DE9")
+
+(define plain-files '("plain-1" "plain-2" "plain-3"))
+(define data-files '("data-500" "data-9000" "data-32000" "data-80000"))
+(define exp-files '())
+
+(define (qualify executable)
+  (string-append executable (getenv "EXEEXT")))
+
+(define (getenv' key default)
+  (let ((value (getenv key)))
+    (if (string=? "" value)
+       default
+       value)))
+
+(define tools
+  '((gpg "GPG" "g10/gpg")
+    (gpg-agent "GPG_AGENT" "agent/gpg-agent")
+    (gpg-connect-agent "GPG_CONNECT_AGENT" "tools/gpg-connect-agent")
+    (gpgconf "GPGCONF" "tools/gpgconf")
+    (gpg-preset-passphrase "GPG_PRESET_PASSPHRASE"
+                          "agent/gpg-preset-passphrase")
+    (mktdata "MKTDATA" "tools/mk-tdata")
+    (gpgtar "GPGTAR" "tools/gpgtar")
+    (gpg-zip "GPGZIP" "tools/gpg-zip")))
+
+(define (tool which)
+  (let ((t (assoc which tools))
+       (prefix (getenv "BIN_PREFIX")))
+    (getenv' (cadr t)
+            (qualify (if (string=? prefix "")
+                         (string-append (getenv "objdir") "/" (caddr t))
+                         (string-append prefix "/" (basename (caddr t))))))))
+
+
+(define have-opt-always-trust
+  (string-contains? (call-popen `(,(tool 'gpg) --dump-options) "")
+                       "--always-trust"))
+
+(define GPG `(,(tool 'gpg) --no-permission-warning
+             ,@(if have-opt-always-trust '(--always-trust) '())))
+(define PINENTRY (string-append (getcwd) "/" (qualify "fake-pinentry")))
+
+(define (tr:gpg input args)
+  (tr:spawn input `(,@GPG --output **out** ,@args **in**)))
+
+(define (pipe:gpg args)
+  (pipe:spawn `(,@GPG --output - ,@args -)))
+
+(define (get-config what)
+  (let* ((config-string
+         (call-popen `(,@GPG --with-colons --list-config ,what) ""))
+        (config (string-splitn
+                 (string-rtrim char-whitespace? config-string) #\: 2)))
+    (string-split (caddr config) #\;)))
+
+(define all-pubkey-algos (get-config "pubkeyname"))
+(define all-hash-algos (get-config "digestname"))
+(define all-cipher-algos (get-config "ciphername"))
+
+(define (have-pubkey-algo? x)
+  (not (not (member x all-pubkey-algos))))
+(define (have-hash-algo? x)
+  (not (not (member x all-hash-algos))))
+(define (have-cipher-algo? x)
+  (not (not (member x all-cipher-algos))))
+
+(define (gpg-pipe args0 args1 errfd)
+  (lambda (source sink)
+    (let* ((p (pipe))
+          (task0 (spawn-process-fd `(,@GPG ,@args0)
+                  source (:write-end p) errfd))
+          (_ (close (:write-end p)))
+          (task1 (spawn-process-fd `(,@GPG ,@args1)
+                  (:read-end p) sink errfd)))
+      (close (:read-end p))
+      (wait-processes (list GPG GPG) (list task0 task1) #t))))
+
+(setenv "GPG_AGENT_INFO" "" #t)
+(setenv "GNUPGHOME" (getcwd) #t)
+
+;;
+;; GnuPG helper.
+;;
+
+;; Call GPG to obtain the hash sums.  Either specify an input file in
+;; ARGS, or an string in INPUT.  Returns a list of (<algo>
+;; "<hashsum>") lists.
+(define (gpg-hash-string args input)
+  (map
+   (lambda (line)
+     (let ((p (string-split line #\:)))
+       (list (string->number (cadr p)) (caddr p))))
+   (string-split
+    (call-popen `(,@GPG --with-colons ,@args) input) #\newline)))
diff --git a/tests/openpgp/detach.scm b/tests/openpgp/detach.scm
new file mode 100755 (executable)
index 0000000..375e922
--- /dev/null
@@ -0,0 +1,31 @@
+#!/usr/bin/env gpgscm
+
+;; Copyright (C) 2016 g10 Code GmbH
+;;
+;; This file is part of GnuPG.
+;;
+;; GnuPG is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; GnuPG is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+(load (with-path "defs.scm"))
+
+(for-each-p
+ "Checking detached signatures"
+ (lambda (source)
+   (lettmp (tmp)
+     (call-popen `(,@GPG --yes --passphrase-fd "0" -sb
+                        --output ,tmp ,source ) usrpass1)
+     (pipe:do
+      (pipe:open source (logior O_RDONLY O_BINARY))
+      (pipe:spawn `(,@GPG --yes ,tmp)))))
+ (append plain-files data-files))
diff --git a/tests/openpgp/detachm.scm b/tests/openpgp/detachm.scm
new file mode 100755 (executable)
index 0000000..a4ebce0
--- /dev/null
@@ -0,0 +1,35 @@
+#!/usr/bin/env gpgscm
+
+;; Copyright (C) 2016 g10 Code GmbH
+;;
+;; This file is part of GnuPG.
+;;
+;; GnuPG is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; GnuPG is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+(load (with-path "defs.scm"))
+
+(define files (append plain-files data-files))
+
+(info "Checking detached signatures of multiple files")
+(lettmp (tmp)
+  (call-popen `(,@GPG --yes --passphrase-fd "0" -sb
+                     --output ,tmp ,@files) usrpass1)
+  (pipe:do
+   (pipe:defer (lambda (sink)
+                (for-each (lambda (file)
+                            (pipe:do
+                             (pipe:open file (logior O_RDONLY O_BINARY))
+                             (pipe:splice sink)))
+                          files)))
+   (pipe:spawn `(,@GPG --yes ,tmp))))
diff --git a/tests/openpgp/ecc.scm b/tests/openpgp/ecc.scm
new file mode 100755 (executable)
index 0000000..f2f3b7c
--- /dev/null
@@ -0,0 +1,249 @@
+#!/usr/bin/env gpgscm
+
+;; Copyright (C) 2016 g10 Code GmbH
+;;
+;; This file is part of GnuPG.
+;;
+;; GnuPG is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; GnuPG is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+(load (with-path "defs.scm"))
+
+(define keygrips '("8E06A180EFFE4C65B812150CAF19BF30C0689A4C"
+                  "E4403F3FD7A443FAC29FEF288FA0D20AC212851E"
+                  "0B7554421FFB14A06CB9F63FB49A85A58E97ABAC"
+                  "303ACC892C2D786C8A789677C0BE54DA8538F903"
+                  "9FE5C36985351524B6AFA19FDCBC1A3A750B6F5F"
+                  "145A52CC7ED3FD41C5B0A26BE220FEED36AF24DE"))
+(define mainkeyids '("BAA59D9C" "0F54719F" "45AF2FFE"))
+
+(unless (have-pubkey-algo? "ECDH")
+       (skip "No ECC support due to an old Libgcrypt"))
+
+(info "Preparing for ECC test")
+(for-each
+ (lambda (grip)
+   (catch '() (unlink (string-append "private-keys-v1.d/" grip ".key")))
+   (call-check `(,(tool 'gpg-preset-passphrase)
+                --preset --passphrase ecc ,grip)))
+ keygrips)
+
+(info "Importing ECC public keys")
+(for-each
+ (lambda (keyid)
+   (call `(,(tool 'gpg) --delete-key --batch --yes ,keyid)))
+ mainkeyids)
+
+(for-each
+ (lambda (n)
+   (call-check `(,(tool 'gpg) --import
+                ,(in-srcdir (string-append
+                             "samplekeys/ecc-sample-"
+                             (number->string n)
+                             "-pub.asc")))))
+ '(1 2 3))
+
+;; The following is an opaque ECDSA signature on a message "This is one
+;; line\n" (17 byte long) by the primary 256 bit key:
+(define msg_opaque_signed_256 "-----BEGIN PGP MESSAGE-----
+Version: GnuPG v2.1.0-ecc (GNU/Linux)
+
+owGbwMvMwCHMvVT3w66lc+cwrlFK4k5N1k3KT6nUK6ko8Zl8MSEkI7NYAYjy81IV
+cjLzUrk64lgYhDkY2FiZQNIMXJwCMO31rxgZ+tW/zesUPxWzdKWrtLGW/LkP5rXL
+V/Yvnr/EKjBbQuvZSYa/klsum6XFmTze+maVgclT6Rc6hzqqxNy6o6qdTTmLJuvp
+AQA=
+=GDv4
+-----END PGP MESSAGE----")
+
+;; The following is an opaque ECDSA signature on a message "This is one
+;; line\n" (17 byte long) by the primary 384 bit key:
+(define msg_opaque_signed_384 "-----BEGIN PGP MESSAGE-----
+Version: PGP Command Line v10.0.0 (Linux)
+
+qANQR1DIqwE7wsvMwCnM2WDcwR9SOJ/xtFISd25qcXFieqpeSUUJAxCEZGQWKwBR
+fl6qQk5mXirXoXJmVgbfYC5xmC5hzsDPjHXqbDLzpXpTBXSZV3L6bAgP3Kq7Ykmo
+7Ds1v4UfBS+3CSSon7Pzq79WLjzXXEH54MkjPxnrw+8cfMVnY7Bi18J702Nnsa7a
+9lMv/PM0/ao9CZ3KX7Q+Tv1rllTZ5Hj4V1frw431QnHfAA==
+=elKT
+-----END PGP MESSAGE-----")
+
+;; The following is an opaque ECDSA signature on a message "This is one
+;; line\n" (17 byte long) by the primary 521 bit key:
+(define msg_opaque_signed_521 "-----BEGIN PGP MESSAGE-----
+Version: PGP Command Line v10.0.0 (Linux)
+
+qANQR1DIwA8BO8LLzMAlnO3Y8tB1vf4/xtNKSdy5qcXFiempeiUVJQxAEJKRWawA
+RPl5qQo5mXmpXIdmMLMy+AaLnoLpEubatpeJY2Lystd7Qt32q2UcvRS5kNPWtDB7
+ryufvcrWtFM7Jx8qXKDxZuqr7b9PGv1Ssk+I8TzB2O9dZC+n/jv+PAdbuu7mLe33
+Gf9pLd3weV3Qno6FOqxGa5ZszQx+uer2xH3/El9x/2pVeO4l15ScsL7qWMTmffmG
+Ic1RdzgeCfosMF+l/zVRchcLKzenEQA=
+=ATtX
+-----END PGP MESSAGE-----")
+
+(lettmp (z)
+  (letfd ((fd (open z (logior O_WRONLY O_CREAT O_BINARY) #o600)))
+        (display "This is one line\n" (fdopen fd "wb")))
+
+  (for-each-p
+   "Checking opaque ECDSA signatures"
+   (lambda (test)
+     (lettmp (x y)
+       (call-with-output-file
+          x (lambda (p) (display (eval test (current-environment)) p)))
+       (call-check `(,(tool 'gpg) --verify ,x))
+       (call-check `(,(tool 'gpg) --output ,y ,x))
+       (unless (file=? y z) (error "mismatch"))))
+   '(msg_opaque_signed_256 msg_opaque_signed_384 msg_opaque_signed_521)))
+
+;;
+;; Import the secret keys so that we now can sign and decrypt.
+;;
+;; Note that the PGP generated secret keys are not self-signed, thus we
+;; need to pass an appropriate option.
+;;
+(info "Importing ECC secret keys")
+(setenv "PINENTRY_USER_DATA" "ecc" #t)
+(for-each
+ (lambda (n)
+   (call-check `(,(tool 'gpg) --import
+                ,@(if (> n 1) '(--allow-non-selfsigned-uid) '())
+                ,(in-srcdir (string-append
+                             "samplekeys/ecc-sample-"
+                             (number->string n)
+                             "-sec.asc")))))
+ '(1 2 3))
+
+;;
+;; Check a few sample encrtpted messages.
+;;
+(info "Checking ECC encryption")
+
+;; The following block encrypts the text "This is one line\n", 17 bytes,
+;; with the subkey 4089AB73.
+(define msg_encrypted_256 "-----BEGIN PGP MESSAGE-----
+Version: GnuPG v2.1.0-ecc (GNU/Linux)
+
+hH4Dd863o0CJq3MSAgMEHdIYZQx+rV1cjy7qitIOEICFFzp4cjsRX4r+rDdMcQUs
+h7VZmbP1c9C0s9sgCKwubWfkcYUl2ZOju4gy+s4MYTBb4/j8JjnJ9Bqn6LWutTXJ
+zwsdP13VIJLnhiNqISdR3/6xWQ0ICRYzwb95nUZ1c1DSVgFpjPgUvi4pgYbTpcDB
+jzILKWBfBDT/jck169XE8vgtbcqVQYZ7lZpaY9CzEbC+4dXZmV1gm5MafpTyFWgH
+VnyrZB4gad9Lp9e0RKHHcOOE7s/NeLuu
+=odUZ
+-----END PGP MESSAGE-----")
+
+;; The following block encrypts the text "This is one line\n", 17 bytes,
+;; with the subkey 9A201946:
+(define msg_encrypted_384 "-----BEGIN PGP MESSAGE-----
+Version: PGP Command Line v10.0.0 (Linux)
+
+qANQR1DBngOqi5OPmiAZRhIDAwQqIr/00cJyf+QP+VA4QKVkk77KMHdz9OVaR2XK
+0VYu0F/HPm89vL2orfm2hrAZxY9G2R0PG4Wk5Lg04UjKca/O72uWtjdPYulFidmo
+uB0QpzXFz22ZZinxeVPLPEr19Pow0EwCc95cg4HAgrD0nV9vRcTJ/+juVfvsJhAO
+isMKqrFNMvwnK5A1ECeyVXe7oLZl0lUBRhLr59QTtvf85QJjg/m5kaGy8XCJvLv3
+61pZa6KUmw89PjtPak7ebcjnINL01vwmyeg1PAyW/xjeGGvcO+R4P1b4ewyFnJyR
+svzIJcP7d4DqYOw7
+=oiTJ
+-----END PGP MESSAGE-----")
+
+;; The following block encrypts the text "This is one line\n", 17 bytes,
+;; with the subkey A81C4838:
+(define msg_encrypted_521 "-----BEGIN PGP MESSAGE-----
+Version: PGP Command Line v10.0.0 (Linux)
+
+qANQR1DBwAIDB+qqSKgcSDgSBCMEAKpzTUxB4c56C7g09ekD9I+ttC5ER/xzDmXU
+OJmFqU5w3FllhFj4TgGxxdH+8fv4W2Ag0IKoJvIY9V1V7oUCClfqAR01QbN7jGH/
+I9GFFnH19AYEgMKgFmh14ZwN1BS6/VHh+H4apaYqapbx8/09EL+DV9zWLX4GRLXQ
+VqCR1N2rXE29MJFzGmDOCueQNkUjcbuenoCSKcNT+6xhO27U9IYVCg4BhRUDGfD6
+dhfRzBLxL+bKR9JVAe46+K8NLjRVu/bd4Iounx4UF5dBk8ERy+/8k9XantDoQgo6
+RPqCad4Dg/QqkpbK3y574ds3VFNJmc4dVpsXm7lGV5w0FBxhVNPoWNhhECMlTroX
+Rg==
+=5GqW
+-----END PGP MESSAGE-----")
+
+(lettmp (z)
+  (letfd ((fd (open z (logior O_WRONLY O_CREAT O_BINARY) #o600)))
+        (display "This is one line\n" (fdopen fd "wb")))
+
+  (for-each-p
+   "Checking ECDSA decryption"
+   (lambda (test)
+     (lettmp (x y)
+       (call-with-output-file
+          x (lambda (p) (display (eval test (current-environment)) p)))
+       (call-check `(,@GPG --yes --output ,y ,x))
+       (unless (file=? y z) (error "mismatch"))))
+   '(msg_encrypted_256 msg_encrypted_384 msg_encrypted_521)))
+
+;;
+;; Now check that we can encrypt and decrypt our own messages.
+;;
+;; Note that we don't need to provide a passppharse because we already
+;; preset the passphrase into the gpg-agent.
+;;
+(for-each-p
+ "Checking ECC encryption and decryption"
+ (lambda (source)
+   (for-each-p
+    ""
+    (lambda (keyid)
+      (tr:do
+       (tr:open source)
+       (tr:gpg "" `(--yes --encrypt --recipient ,keyid))
+       (tr:gpg "" '(--yes))
+       (tr:assert-identity source)))
+    mainkeyids))
+ (append plain-files data-files))
+
+;;
+;; Now check that we can sign and verify our own messages.
+;;
+(for-each-p
+ "Checking ECC signing and verifiction"
+ (lambda (source)
+   (for-each-p
+    ""
+    (lambda (keyid)
+      (tr:do
+       (tr:open source)
+       (tr:gpg "" `(--yes --sign --local-user ,keyid))
+       (tr:gpg "" '(--yes))
+       (tr:assert-identity source)))
+    mainkeyids))
+ (append plain-files data-files))
+
+;;
+;; Let us also try to import the keys only from a secret keyblock.
+;;
+;; Because PGP does not sign the UID, it is not very useful to work
+;; with this key unless we go into the trouble of adding the
+;; self-signature.
+;;
+(info "Importing ECC secret keys directly")
+(for-each
+ (lambda (keyid)
+   (catch '() (unlink (string-append "private-keys-v1.d/" keyid ".key"))))
+ keygrips)
+(for-each
+ (lambda (keyid)
+   (call `(,(tool 'gpg) --delete-key --batch --yes ,keyid)))
+ mainkeyids)
+
+(for-each
+ (lambda (n)
+   (call-check `(,(tool 'gpg) --import
+                ,@(if (> n 1) '(--allow-non-selfsigned-uid) '())
+                ,(in-srcdir (string-append
+                             "samplekeys/ecc-sample-"
+                             (number->string n)
+                             "-sec.asc")))))
+ '(1 2 3))
diff --git a/tests/openpgp/encrypt-dsa.scm b/tests/openpgp/encrypt-dsa.scm
new file mode 100755 (executable)
index 0000000..5228e43
--- /dev/null
@@ -0,0 +1,45 @@
+#!/usr/bin/env gpgscm
+
+;; Copyright (C) 2016 g10 Code GmbH
+;;
+;; This file is part of GnuPG.
+;;
+;; GnuPG is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; GnuPG is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+(load (with-path "defs.scm"))
+
+(for-each-p
+ "Checking encryption using DSA"
+ (lambda (source)
+   (tr:do
+    (tr:open source)
+    (tr:gpg "" `(--yes --encrypt --recipient ,dsa-usrname2))
+    (tr:gpg "" '(--yes))
+    (tr:assert-identity source)))
+ (append plain-files data-files))
+
+(for-each-p
+ "Checking encryption using DSA and a specific cipher algorithm"
+ (lambda (cipher)
+   (for-each-p
+    ""
+    (lambda (source)
+      (tr:do
+       (tr:open source)
+       (tr:gpg "" `(--yes --encrypt --recipient ,dsa-usrname2
+                         --cipher-algo ,cipher))
+       (tr:gpg "" '(--yes))
+       (tr:assert-identity source)))
+    (append plain-files data-files)))
+ all-cipher-algos)
diff --git a/tests/openpgp/encrypt.scm b/tests/openpgp/encrypt.scm
new file mode 100755 (executable)
index 0000000..5a3e178
--- /dev/null
@@ -0,0 +1,45 @@
+#!/usr/bin/env gpgscm
+
+;; Copyright (C) 2016 g10 Code GmbH
+;;
+;; This file is part of GnuPG.
+;;
+;; GnuPG is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; GnuPG is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+(load (with-path "defs.scm"))
+
+(for-each-p
+ "Checking encryption"
+ (lambda (source)
+   (tr:do
+    (tr:open source)
+    (tr:gpg "" `(--yes --encrypt --recipient ,usrname2))
+    (tr:gpg "" '(--yes))
+    (tr:assert-identity source)))
+ (append plain-files data-files))
+
+(for-each-p
+ "Checking encryption using a specific cipher algorithm"
+ (lambda (cipher)
+   (for-each-p
+    ""
+    (lambda (source)
+      (tr:do
+       (tr:open source)
+       (tr:gpg "" `(--yes --encrypt --recipient ,usrname2
+                         --cipher-algo ,cipher))
+       (tr:gpg "" '(--yes))
+       (tr:assert-identity source)))
+    (append plain-files data-files)))
+ all-cipher-algos)
diff --git a/tests/openpgp/encryptp.scm b/tests/openpgp/encryptp.scm
new file mode 100755 (executable)
index 0000000..2b010ac
--- /dev/null
@@ -0,0 +1,31 @@
+#!/usr/bin/env gpgscm
+
+;; Copyright (C) 2016 g10 Code GmbH
+;;
+;; This file is part of GnuPG.
+;;
+;; GnuPG is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; GnuPG is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+(load (with-path "defs.scm"))
+
+(for-each-p
+ "Checking encryption and decryption using pipes"
+ (lambda (source)
+   (tr:do
+    (tr:open source)
+    (tr:pipe-do
+     (pipe:gpg `(--yes --encrypt --recipient ,usrname2))
+     (pipe:gpg '(--yes)))
+    (tr:assert-identity source)))
+ (append plain-files data-files))
diff --git a/tests/openpgp/finish.scm b/tests/openpgp/finish.scm
new file mode 100755 (executable)
index 0000000..48801c8
--- /dev/null
@@ -0,0 +1,23 @@
+#!/usr/bin/env gpgscm
+
+;; Copyright (C) 2016 g10 Code GmbH
+;;
+;; This file is part of GnuPG.
+;;
+;; GnuPG is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; GnuPG is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+(load (with-path "defs.scm"))
+
+(echo "Killing gpg-agent...")
+(call-check `(,(tool 'gpg-connect-agent) --verbose killagent /bye))
diff --git a/tests/openpgp/genkey1024.scm b/tests/openpgp/genkey1024.scm
new file mode 100755 (executable)
index 0000000..9870f46
--- /dev/null
@@ -0,0 +1,52 @@
+#!/usr/bin/env gpgscm
+
+;; Copyright (C) 2016 g10 Code GmbH
+;;
+;; This file is part of GnuPG.
+;;
+;; GnuPG is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; GnuPG is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+(load (with-path "defs.scm"))
+
+(define (genkey config)
+  (pipe:do
+   (pipe:echo config)
+   (pipe:spawn `(,(tool 'gpg) --quiet --batch --gen-key))))
+
+(info "Checking batch key generation")
+(genkey "Key-Type: DSA
+Key-Length: 1024
+Subkey-Type: ELG
+Subkey-Length: 1024
+Name-Real: Harry H.
+Name-Comment: test key
+Name-Email: hh@@ddorf.de
+Expire-Date: 1
+%no-protection
+%transient-key
+%commit
+")
+
+(if (have-pubkey-algo? "RSA")
+    (genkey "Key-Type: RSA
+Key-Length: 1024
+Key-Usage: sign,encrypt
+Name-Real: Harry A.
+Name-Comment: RSA test key
+Name-Email: hh@@ddorf.de
+Expire-Date: 2
+%no-protection
+%transient-key
+%commit
+"))
diff --git a/tests/openpgp/gpgtar.scm b/tests/openpgp/gpgtar.scm
new file mode 100755 (executable)
index 0000000..d406079
--- /dev/null
@@ -0,0 +1,88 @@
+#!/usr/bin/env gpgscm
+
+;; Copyright (C) 2016 g10 Code GmbH
+;;
+;; This file is part of GnuPG.
+;;
+;; GnuPG is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; GnuPG is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+(load (with-path "defs.scm"))
+
+(unless (= 0 (call `(,(tool 'gpgtar) --help)))
+       (skip "gpgtar not installed"))
+
+(define testfiles (append plain-files data-files))
+(define gpgargs
+  (if have-opt-always-trust
+      "--no-permission-warning --always-trust"
+      "--no-permission-warning"))
+
+(define (do-test create-flags inspect-flags extract-flags)
+  (lettmp (archive)
+    (call-check `(,(tool 'gpgtar) --gpg ,(tool 'gpg) --gpg-args ,gpgargs
+                 ,@create-flags
+                 --output ,archive
+                 ,@testfiles))
+    (tr:do
+     (tr:pipe-do
+      (pipe:spawn `(,(tool 'gpgtar) --gpg ,(tool 'gpg) --gpg-args ,gpgargs
+                   --list-archive ,@inspect-flags
+                   ,archive)))
+     (tr:call-with-content
+      (lambda (c)
+       (unless (all (lambda (f) (string-contains? c f)) testfiles)
+               (error "some file(s) are missing from archive")))))
+
+    (with-temporary-working-directory
+     (call-check `(,(tool 'gpgtar) --gpg ,(tool 'gpg) --gpg-args ,gpgargs
+                  --tar-args --directory=.
+                  --decrypt
+                  ,@extract-flags
+                  ,archive))
+
+     (for-each
+      (lambda (f) (unless (call-with-input-file f (lambda (x) #t))
+                         (error (string-append "missing file: " f))))
+      testfiles))))
+
+(info "Checking gpgtar without encryption")
+(do-test `(--skip-crypto --encrypt) '(--skip-crypto) '(--skip-crypto))
+
+(info "Checking gpgtar with asymmetric encryption")
+(do-test `(--encrypt --recipient ,usrname2) '() '())
+
+(info "Checking gpgtar with asymmetric encryption and signature")
+(do-test `(--encrypt --recipient ,usrname2 --sign --local-user ,usrname3)
+        '() '())
+
+(info "Checking gpgtar with signature")
+(do-test `(--sign --local-user ,usrname3) '() '())
+
+(lettmp (passphrasefile)
+  (letfd ((fd (open passphrasefile (logior O_WRONLY O_CREAT O_BINARY) #o600)))
+    (display "streng geheimes hupsipupsi" (fdopen fd "wb")))
+
+  (let ((ppflags `(--gpg-args ,(string-append "--passphrase-file="
+                                             passphrasefile))))
+    (info "Checking gpgtar with symmetric encryption")
+    (do-test `(,@ppflags --symmetric) ppflags ppflags)
+
+    (info "Checking gpgtar with symmetric encryption and chosen cipher")
+    (do-test `(,@ppflags --symmetric --gpg-args
+                        ,(string-append "--cipher=" (car all-cipher-algos)))
+            ppflags ppflags)
+
+    (info "Checking gpgtar with both symmetric and asymmetric encryption")
+    (do-test `(,@ppflags --symmetric --encrypt --recipient ,usrname2
+                        --sign --local-user ,usrname3) ppflags ppflags)))
diff --git a/tests/openpgp/import.scm b/tests/openpgp/import.scm
new file mode 100755 (executable)
index 0000000..580acea
--- /dev/null
@@ -0,0 +1,60 @@
+#!/usr/bin/env gpgscm
+
+;; Copyright (C) 2016 g10 Code GmbH
+;;
+;; This file is part of GnuPG.
+;;
+;; GnuPG is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; GnuPG is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+(load (with-path "defs.scm"))
+
+(info "Checking bug 894: segv importing certain keys.")
+(call-check `(,(tool 'gpg) --import ,(in-srcdir "bug894-test.asc")))
+
+(define keyid "0xC108E83A")
+(info "Checking bug 1223: designated revoker sigs are not properly merged.")
+(call `(,(tool 'gpg) --delete-key --batch --yes ,keyid))
+(call `(,(tool 'gpg) --import ,(in-srcdir "bug1223-bogus.asc")))
+(call `(,(tool 'gpg) --import ,(in-srcdir "bug1223-good.asc")))
+(tr:do
+ (tr:pipe-do
+  (pipe:gpg `(--list-keys --with-colons ,keyid)))
+ (tr:call-with-content
+  (lambda (c)
+    ;; XXX we do not have a regexp library
+    (unless (any (lambda (line)
+                  (and (string-prefix? line "rvk:")
+                       (string-contains? line ":0EE5BE979282D80B9F7540F1CCD2ED94D21739E9:")))
+                (string-split c #\newline))
+           (exit 1)))))
+
+(define fpr1 "9E669861368BCA0BE42DAF7DDDA252EBB8EBE1AF")
+(define fpr2 "A55120427374F3F7AA5F1166DDA252EBB8EBE1AF")
+(info "Checking import of two keys with colliding long key ids.")
+(call `(,(tool 'gpg) --delete-key --batch --yes ,fpr1 ,fpr2))
+(call `(,(tool 'gpg) --import ,(in-srcdir "samplekeys/dda252ebb8ebe1af-1.asc")))
+(call `(,(tool 'gpg) --import ,(in-srcdir "samplekeys/dda252ebb8ebe1af-2.asc")))
+(tr:do
+ (tr:pipe-do
+  (pipe:gpg `(--list-keys --with-colons ,fpr1 ,fpr2)))
+ (tr:call-with-content
+  (lambda (c)
+    ;; XXX we do not have a regexp library
+    (let ((keys (filter
+                (lambda (line)
+                  (and (string-prefix? line "pub:")
+                       (string-contains? line ":4096:1:DDA252EBB8EBE1AF:")))
+                (string-split c #\newline))))
+      (unless (= 2 (length keys))
+             (error "Importing keys with long id collision failed"))))))
diff --git a/tests/openpgp/mds.scm b/tests/openpgp/mds.scm
new file mode 100755 (executable)
index 0000000..8ca6c7b
--- /dev/null
@@ -0,0 +1,68 @@
+#!/usr/bin/env gpgscm
+
+;; Copyright (C) 2016 g10 Code GmbH
+;;
+;; This file is part of GnuPG.
+;;
+;; GnuPG is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; GnuPG is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+(load (with-path "defs.scm"))
+
+(define empty-string-hashes
+  `((1 "D41D8CD98F00B204E9800998ECF8427E" "MD5")
+    (2 "DA39A3EE5E6B4B0D3255BFEF95601890AFD80709" "SHA1")
+    (3 "9C1185A5C5E9FC54612808977EE8F548B2258D31" "RIPEMD160")
+    (11 "D14A028C2A3A2BC9476102BB288234C415A2B01F828EA62AC5B3E42F" "SHA224")
+    (8 "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855" "SHA256")
+    (9 "38B060A751AC96384CD9327EB1B1E36A21FDB71114BE07434C0CC7BF63F6E1DA274EDEBFE76F65FBD51AD2F14898B95B" "SHA384")
+    (10
+     "CF83E1357EEFB8BDF1542850D66D8007D620E4050B5715DC83F4A921D36CE9CE47D0D13C5D85F2B0FF8318D2877EEC2F63B931BD47417A81A538327AF927DA3E"
+     "SHA512")))
+
+(define abc-hashes
+  `((1 "C3FCD3D76192E4007DFB496CCA67E13B" "MD5")
+    (2 "32D10C7B8CF96570CA04CE37F2A19D84240D3A89" "SHA1")
+    (3 "F71C27109C692C1B56BBDCEB5B9D2865B3708DBC" "RIPEMD160")
+    (11 "45A5F72C39C5CFF2522EB3429799E49E5F44B356EF926BCF390DCCC2" "SHA224")
+    (8 "71C480DF93D6AE2F1EFAD1447C66C9525E316218CF51FC8D9ED832F2DAF18B73" "SHA256")
+    (9 "FEB67349DF3DB6F5924815D6C3DC133F091809213731FE5C7B5F4999E463479FF2877F5F2936FA63BB43784B12F3EBB4" "SHA384")
+    (10 "4DBFF86CC2CA1BAE1E16468A05CB9881C97F1753BCE3619034898FAA1AABE429955A1BF8EC483D7421FE3C1646613A59ED5441FB0F321389F77F48A879C7B1F1" "SHA512")))
+
+;; Symbolic names for the triples above.
+(define :algo car)
+(define :value cadr)
+(define :name caddr)
+
+;; Test whether HASH matches REF.
+(define (test-hash hash ref)
+  (unless (eq? #f ref)
+         (if (not (string=? (:value hash) (:value ref)))
+           (error "failed"))))
+
+;; Test whether the hashes computed over S match the REFERENCE set.
+(define (test-hashes msg s reference)
+  (for-each-p'
+   msg
+   (lambda (hash) (test-hash hash (assv (:algo hash) reference)))
+   (lambda (hash)
+     (let ((ref (assv (:algo hash) reference)))
+       (if (eq? #f ref)
+          (string-append "no-ref-for:" (number->string (:algo hash)))
+          (:name ref))))
+   (gpg-hash-string '(--print-mds) s)))
+
+(test-hashes "Hashing the empty string"
+ "" empty-string-hashes)
+(test-hashes "Hashing the string \"abcdefghijklmnopqrstuvwxyz\""
+ "abcdefghijklmnopqrstuvwxyz" abc-hashes)
diff --git a/tests/openpgp/multisig.scm b/tests/openpgp/multisig.scm
new file mode 100755 (executable)
index 0000000..3788f67
--- /dev/null
@@ -0,0 +1,172 @@
+#!/usr/bin/env gpgscm
+
+;; Copyright (C) 2016 g10 Code GmbH
+;;
+;; This file is part of GnuPG.
+;;
+;; GnuPG is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; GnuPG is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+;; Check that gpg verifies only signatures where there is no ambiguity
+;; in the order of packets.  Needs the Demo Keys Lima and Mike.
+;;
+;; Note: We do not support multiple signatures anymore thus this test is
+;; not really needed because verify could do the same.  We keep it anyway.
+
+(load (with-path "defs.scm"))
+
+(define sig-1ls1ls-valid "
+-----BEGIN PGP ARMORED FILE-----
+
+kA0DAAIRN8q1H7eRA/gBrCdiBXRleHQxOogq9EkgYW0gc29ycnksIEkgY2FuJ3Qg
+ZG8gdGhhdAqIPwMFADqIKvQ3yrUft5ED+BEC2joAoJaSaXOZEtSZqQ780HIXG77e
+8PB7AJ4wCprmaFTO0fBaTcXDuEOBdAWnOZANAwACETfKtR+3kQP4AawnYgV0ZXh0
+MTqIKvRJIGFtIHNvcnJ5LCBJIGNhbid0IGRvIHRoYXQKiD8DBQA6iCr0N8q1H7eR
+A/gRAto6AKCWkmlzmRLUmakO/NByFxu+3vDwewCeMAqa5mhUztHwWk3Fw7hDgXQF
+pzk=
+=8jSC
+-----END PGP ARMORED FILE-----
+")
+(define sig-ls-valid "
+-----BEGIN PGP ARMORED FILE-----
+
+rCdiBXRleHQxOogrS0kgYW0gc29ycnksIEkgY2FuJ3QgZG8gdGhhdAqIPwMFADqI
+K0s3yrUft5ED+BECLQMAn2jZUNOpB4OuurSQkc2TRfg6ek02AJ9+oJS0frQ+yUsT
+QDUFTH2PvZRxjw==
+=J+lb
+-----END PGP ARMORED FILE-----
+")
+(define sig-sl-valid "
+-----BEGIN PGP ARMORED FILE-----
+
+iD8DBQA6iCtLN8q1H7eRA/gRAi0DAJ9o2VDTqQeDrrq0kJHNk0X4OnpNNgCffqCU
+tH60PslLE0A1BUx9j72UcY+sJ2IFdGV4dDE6iCtLSSBhbSBzb3JyeSwgSSBjYW4n
+dCBkbyB0aGF0Cg==
+=N9MP
+-----END PGP ARMORED FILE-----
+")
+(define sig-11lss-valid-but-is-not "
+-----BEGIN PGP ARMORED FILE-----
+
+kA0DAAIRN8q1H7eRA/gAkA0DAAIRN8q1H7eRA/gBrCdiBXRleHQxOogyXUkgYW0g
+c29ycnksIEkgY2FuJ3QgZG8gdGhhdAqIPwMFADqIMl03yrUft5ED+BECwQAAnRXT
+mXjVd385oD38W80XuheWKTGcAJ9pZ6/flaKDfw+SLido7xaUHuhp5Yg/AwUAOogy
+XTfKtR+3kQP4EQLBAACgnN0IP+NztE0aAc/DZ17yHWR9diwAniN0P01WmbgZJoZB
+Q341WRXKS/at
+=Ekrs
+-----END PGP ARMORED FILE-----
+")
+(define sig-11lss11lss-valid-but-is-not "
+-----BEGIN PGP ARMORED FILE-----
+
+kA0DAAIRN8q1H7eRA/gAkA0DAAIRN8q1H7eRA/gBrCdiBXRleHQxOogyXUkgYW0g
+c29ycnksIEkgY2FuJ3QgZG8gdGhhdAqIPwMFADqIMl03yrUft5ED+BECwQAAnRXT
+mXjVd385oD38W80XuheWKTGcAJ9pZ6/flaKDfw+SLido7xaUHuhp5Yg/AwUAOogy
+XTfKtR+3kQP4EQLBAACgnN0IP+NztE0aAc/DZ17yHWR9diwAniN0P01WmbgZJoZB
+Q341WRXKS/atkA0DAAIRN8q1H7eRA/gAkA0DAAIRN8q1H7eRA/gBrCdiBXRleHQx
+OogyXUkgYW0gc29ycnksIEkgY2FuJ3QgZG8gdGhhdAqIPwMFADqIMl03yrUft5ED
++BECwQAAnRXTmXjVd385oD38W80XuheWKTGcAJ9pZ6/flaKDfw+SLido7xaUHuhp
+5Yg/AwUAOogyXTfKtR+3kQP4EQLBAACgnN0IP+NztE0aAc/DZ17yHWR9diwAniN0
+P01WmbgZJoZBQ341WRXKS/at
+=P1Mu
+-----END PGP ARMORED FILE-----
+")
+(define sig-ssl-valid-but-is-not "
+-----BEGIN PGP ARMORED FILE-----
+
+iD8DBQA6iCtLN8q1H7eRA/gRAi0DAJ9o2VDTqQeDrrq0kJHNk0X4OnpNNgCffqCU
+tH60PslLE0A1BUx9j72UcY+IPwMFADqIK0s3yrUft5ED+BECLQMAn2jZUNOpB4Ou
+urSQkc2TRfg6ek02AJ9+oJS0frQ+yUsTQDUFTH2PvZRxj6wnYgV0ZXh0MTqIK0tJ
+IGFtIHNvcnJ5LCBJIGNhbid0IGRvIHRoYXQK
+=Zven
+-----END PGP ARMORED FILE-----
+")
+(define sig-1lsls-invalid "
+-----BEGIN PGP ARMORED FILE-----
+
+kA0DAAIRN8q1H7eRA/gBrCdiBXRleHQxOogq9EkgYW0gc29ycnksIEkgY2FuJ3Qg
+ZG8gdGhhdAqIPwMFADqIKvQ3yrUft5ED+BEC2joAoJaSaXOZEtSZqQ780HIXG77e
+8PB7AJ4wCprmaFTO0fBaTcXDuEOBdAWnOawnYgV0ZXh0MTqIK0tJIGFtIHNvcnJ5
+LCBJIGNhbid0IGRvIHRoYXQKiD8DBQA6iCtLN8q1H7eRA/gRAi0DAJ9o2VDTqQeD
+rrq0kJHNk0X4OnpNNgCffqCUtH60PslLE0A1BUx9j72UcY8=
+=nkeu
+-----END PGP ARMORED FILE-----
+")
+(define sig-lsls-invalid "
+-----BEGIN PGP ARMORED FILE-----
+
+rCdiBXRleHQxOogrS0kgYW0gc29ycnksIEkgY2FuJ3QgZG8gdGhhdAqIPwMFADqI
+K0s3yrUft5ED+BECLQMAn2jZUNOpB4OuurSQkc2TRfg6ek02AJ9+oJS0frQ+yUsT
+QDUFTH2PvZRxj6wnYgV0ZXh0MTqIK0tJIGFtIHNvcnJ5LCBJIGNhbid0IGRvIHRo
+YXQKiD8DBQA6iCtLN8q1H7eRA/gRAi0DAJ9o2VDTqQeDrrq0kJHNk0X4OnpNNgCf
+fqCUtH60PslLE0A1BUx9j72UcY8=
+=BlZH
+-----END PGP ARMORED FILE-----
+")
+(define sig-lss-invalid "
+-----BEGIN PGP ARMORED FILE-----
+
+rCdiBXRleHQxOogrS0kgYW0gc29ycnksIEkgY2FuJ3QgZG8gdGhhdAqIPwMFADqI
+K0s3yrUft5ED+BECLQMAn2jZUNOpB4OuurSQkc2TRfg6ek02AJ9+oJS0frQ+yUsT
+QDUFTH2PvZRxj4g/AwUAOogrSzfKtR+3kQP4EQItAwCfaNlQ06kHg666tJCRzZNF
++Dp6TTYAn36glLR+tD7JSxNANQVMfY+9lHGP
+=jmt6
+-----END PGP ARMORED FILE-----
+")
+(define sig-slsl-invalid "
+-----BEGIN PGP ARMORED FILE-----
+
+iD8DBQA6iCtLN8q1H7eRA/gRAi0DAJ9o2VDTqQeDrrq0kJHNk0X4OnpNNgCffqCU
+tH60PslLE0A1BUx9j72UcY+sJ2IFdGV4dDE6iCtLSSBhbSBzb3JyeSwgSSBjYW4n
+dCBkbyB0aGF0Cog/AwUAOogrSzfKtR+3kQP4EQItAwCfaNlQ06kHg666tJCRzZNF
++Dp6TTYAn36glLR+tD7JSxNANQVMfY+9lHGPrCdiBXRleHQxOogrS0kgYW0gc29y
+cnksIEkgY2FuJ3QgZG8gdGhhdAo=
+=phBF
+-----END PGP ARMORED FILE-----
+")
+
+(for-each-p
+ "Checking that a valid signature is verified as such"
+ (lambda (armored-file)
+   (tr:do
+    (tr:pipe-do
+     (pipe:echo (eval armored-file (current-environment)))
+     (pipe:spawn `(,@GPG --dearmor)))
+    (tr:spawn "" `(,@GPG --verify **in**))))
+ '(sig-sl-valid))
+
+;; ???
+;;
+;; #for i in "$sig-11lss-valid-but-is-not" "$sig-11lss11lss-valid-but-is-not" \
+;; #         "$sig-ssl-valid-but-is-not"; do
+;; #    echo "$i" | $GPG --dearmor >x
+;; #    $GPG --verify <x 2>/dev/null || error "valid is invalid"
+;; #done
+
+(for-each-p
+ "Checking that an invalid signature is verified as such"
+ (lambda (armored-file)
+   (tr:do
+    (tr:pipe-do
+     (pipe:echo (eval armored-file (current-environment)))
+     (pipe:spawn `(,@GPG --dearmor)))
+    ;; XXX: this is ugly
+    (lambda args
+      (if (catch #f ;; verifikation failed, this is what we want
+                (apply (tr:spawn "" `(,@GPG --verify **in**)) args)
+                ;; verification succeded, this is an error.
+                #t)
+         (error "invalid signature is valid")
+         args))))
+ '(sig-1ls1ls-valid sig-ls-valid sig-1lsls-invalid
+                   sig-lsls-invalid sig-lss-invalid sig-slsl-invalid))
diff --git a/tests/openpgp/run-tests.scm b/tests/openpgp/run-tests.scm
new file mode 100644 (file)
index 0000000..a921fdb
--- /dev/null
@@ -0,0 +1,209 @@
+;; Test-suite runner.
+;;
+;; Copyright (C) 2016 g10 Code GmbH
+;;
+;; This file is part of GnuPG.
+;;
+;; GnuPG is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; GnuPG is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+(if (string=? "" (getenv "srcdir"))
+    (begin
+      (echo "Environment variable 'srcdir' not set.  Please point it to"
+           "tests/openpgp.")
+      (exit 2)))
+
+;; Set objdir so that the tests can locate built programs.
+(setenv "objdir" (getcwd) #f)
+
+(define test-pool
+  (package
+   (define (new procs)
+     (package
+      (define (add test)
+       (new (cons test procs)))
+      (define (wait)
+       (let ((unfinished (filter (lambda (t) (not t::retcode)) procs)))
+         (if (null? unfinished)
+             (package)
+             (let* ((commands (map (lambda (t) t::command) unfinished))
+                    (pids (map (lambda (t) t::pid) unfinished))
+                    (results
+                     (map (lambda (pid retcode) (list pid retcode))
+                          pids
+                          (wait-processes (map stringify commands) pids #t))))
+               (new
+                (map (lambda (t)
+                       (if t::retcode
+                           t
+                           (t::set-retcode (cadr (assoc t::pid results)))))
+                     procs))))))
+      (define (passed)
+       (filter (lambda (p) (= 0 p::retcode)) procs))
+      (define (skipped)
+       (filter (lambda (p) (= 77 p::retcode)) procs))
+      (define (hard-errored)
+       (filter (lambda (p) (= 99 p::retcode)) procs))
+      (define (failed)
+       (filter (lambda (p)
+                 (not (or (= 0 p::retcode) (= 77 p::retcode)
+                          (= 99 p::retcode))))
+               procs))
+      (define (report)
+       (echo (length procs) "tests run,"
+             (length (passed)) "succeeded,"
+             (length (failed)) "failed,"
+             (length (skipped)) "skipped.")
+       (length (failed)))))))
+
+(define (verbosity n)
+  (if (= 0 n) '() (cons '--verbose (verbosity (- n 1)))))
+
+(define test
+  (package
+   (define (scm name . args)
+     (new name #f `(,*argv0* ,@(verbosity *verbose*) ,@args
+                            ,(in-srcdir name)) #f #f))
+   (define (new name directory command pid retcode)
+     (package
+      (define (set-directory x)
+       (new name x command pid retcode))
+      (define (set-retcode x)
+       (new name directory command pid x))
+      (define (set-pid x)
+       (new name directory command x retcode))
+      (define (run-sync)
+       (with-working-directory directory
+         (let* ((p (inbound-pipe))
+                (pid (spawn-process-fd command CLOSED_FD
+                                       (:write-end p) (:write-end p))))
+           (close (:write-end p))
+           (splice (:read-end p) STDERR_FILENO)
+           (close (:read-end p))
+           (let ((t' (set-retcode (wait-process name pid #t))))
+             (t'::report)
+             t'))))
+      (define (run-sync-quiet)
+       (with-working-directory directory
+         (set-retcode
+          (wait-process
+           name (spawn-process-fd command CLOSED_FD CLOSED_FD CLOSED_FD) #t))))
+      (define (run-async)
+       (with-working-directory directory
+         (set-pid (spawn-process-fd command CLOSED_FD CLOSED_FD CLOSED_FD))))
+      (define (status)
+       (let ((t (assoc retcode '((0 "PASS") (77 "SKIP") (99 "ERROR")))))
+         (if (not t) "FAIL" (cadr t))))
+      (define (report)
+       (echo (string-append (status retcode) ":") name))))))
+
+(define (run-tests-parallel-shared setup teardown . tests)
+  (setup::run-sync)
+  (let loop ((pool (test-pool::new '())) (tests' tests))
+    (if (null? tests')
+       (let ((results (pool::wait)))
+         (for-each (lambda (t) (t::report)) results::procs)
+         (teardown::run-sync)
+         (exit (results::report)))
+       (let ((test (car tests')))
+         (loop (pool::add (test::run-async)) (cdr tests'))))))
+
+(define (run-tests-parallel-isolated setup teardown . tests)
+  (let loop ((pool (test-pool::new '())) (tests' tests))
+    (if (null? tests')
+       (let ((results (pool::wait)))
+         (for-each (lambda (t)
+                     (let ((teardown' (teardown::set-directory t::directory)))
+                       (teardown'::run-sync-quiet))
+                     (unlink-recursively t::directory)
+                     (t::report)) results::procs)
+         (exit (results::report)))
+       (let* ((wd (mkdtemp "gpgscm-XXXXXX"))
+              (test (car tests'))
+              (test' (test::set-directory wd))
+              (setup' (setup::set-directory wd)))
+         (setup'::run-sync-quiet)
+         (loop (pool::add (test'::run-async)) (cdr tests'))))))
+
+(define (run-tests-sequential-shared setup teardown . tests)
+  (let loop ((pool (test-pool::new '()))
+            (tests' `(,setup ,@tests ,teardown)))
+    (if (null? tests')
+       (let ((results (pool::wait)))
+         (exit (results::report)))
+       (let ((test (car tests')))
+         (loop (pool::add (test::run-sync)) (cdr tests'))))))
+
+(define (run-tests-sequential-isolated setup teardown . tests)
+  (let loop ((pool (test-pool::new '())) (tests' tests))
+    (if (null? tests')
+       (let ((results (pool::wait)))
+         (for-each (lambda (t)
+                     (let ((teardown' (teardown::set-directory t::directory)))
+                       (teardown'::run-sync-quiet))
+                     (unlink-recursively t::directory))
+                   results::procs)
+         (exit (results::report)))
+       (let* ((wd (mkdtemp "gpgscm-XXXXXX"))
+              (test (car tests'))
+              (test' (test::set-directory wd))
+              (setup' (setup::set-directory wd)))
+         (setup'::run-sync-quiet)
+         (loop (pool::add (test'::run-sync)) (cdr tests'))))))
+
+(define all-tests
+  '("version.scm"
+    "mds.scm"
+    "decrypt.scm"
+    "decrypt-dsa.scm"
+    "sigs.scm"
+    "sigs-dsa.scm"
+    "encrypt.scm"
+    "encrypt-dsa.scm"
+    "seat.scm"
+    "clearsig.scm"
+    "encryptp.scm"
+    "detach.scm"
+    "detachm.scm"
+    "armsigs.scm"
+    "armencrypt.scm"
+    "armencryptp.scm"
+    "signencrypt.scm"
+    "signencrypt-dsa.scm"
+    "armsignencrypt.scm"
+    "armdetach.scm"
+    "armdetachm.scm"
+    "genkey1024.scm"
+    "conventional.scm"
+    "conventional-mdc.scm"
+    "multisig.scm"
+    "verify.scm"
+    "armor.scm"
+    "import.scm"
+    "ecc.scm"
+    "4gb-packet.scm"
+    "gpgtar.scm"
+    "use-exact-key.scm"
+    "default-key.scm"))
+
+(let* ((runner (if (member "--parallel" *args*)
+                 (if (member "--shared" *args*)
+                     run-tests-parallel-shared
+                     run-tests-parallel-isolated)
+                 (if (member "--shared" *args*)
+                     run-tests-sequential-shared
+                     run-tests-sequential-isolated)))
+       (tests' (filter (lambda (arg) (not (string-prefix? arg "--"))) *args*))
+       (tests (if (null? tests') all-tests tests')))
+  (apply runner (append (list (test::scm "setup.scm") (test::scm "finish.scm"))
+                       (map test::scm tests))))
diff --git a/tests/openpgp/seat.scm b/tests/openpgp/seat.scm
new file mode 100755 (executable)
index 0000000..aceecca
--- /dev/null
@@ -0,0 +1,30 @@
+#!/usr/bin/env gpgscm
+
+;; Copyright (C) 2016 g10 Code GmbH
+;;
+;; This file is part of GnuPG.
+;;
+;; GnuPG is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; GnuPG is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+(load (with-path "defs.scm"))
+
+(for-each-p
+ "Checking encryption, signing, and producing armored output"
+ (lambda (source)
+   (tr:do
+    (tr:open source)
+    (tr:gpg usrpass1 '(--yes -seat -r two@example.com --passphrase-fd "0"))
+    (tr:gpg "" '(--yes))
+    (tr:assert-weak-identity source)))
+ plain-files)
diff --git a/tests/openpgp/setup.scm b/tests/openpgp/setup.scm
new file mode 100755 (executable)
index 0000000..6518dae
--- /dev/null
@@ -0,0 +1,121 @@
+#!/usr/bin/env gpgscm
+
+;; Copyright (C) 2016 g10 Code GmbH
+;;
+;; This file is part of GnuPG.
+;;
+;; GnuPG is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; GnuPG is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+(load (with-path "defs.scm"))
+
+(echo "Creating test environment...")
+
+(letfd ((fd (open "random_seed" (logior O_WRONLY O_CREAT O_BINARY) #o600)))
+  (call-with-fds (list (tool 'mktdata) "600") CLOSED_FD fd STDERR_FILENO))
+
+(for-each-p
+ "Creating configuration files"
+ (lambda (name)
+   (file-copy (in-srcdir (string-append name ".tmpl")) name)
+   (let ((p (open-input-output-file name)))
+     (cond
+      ((string=? "gpg.conf" name)
+       (if have-opt-always-trust
+          (display "no-auto-check-trustdb\n" p))
+       (display (string-append "agent-program "
+                              (tool 'gpg-agent)
+                              "|--debug-quick-random\n") p)
+       (display "allow-weak-digest-algos\n" p))
+      ((string=? "gpg-agent.conf" name)
+       (display (string-append "pinentry-program " PINENTRY "\n") p)))))
+ '("gpg.conf" "gpg-agent.conf"))
+
+(echo "Starting gpg-agent...")
+(call-check `(,(tool 'gpg-connect-agent) --verbose
+             ,(string-append "--agent-program=" (tool 'gpg-agent)
+                             "|--debug-quick-random")
+             /bye))
+
+(for-each-p "Creating sample data files"
+  (lambda (size)
+    (letfd ((fd (open (string-append "data-" (number->string size))
+                     (logior O_WRONLY O_CREAT O_BINARY) #o600)))
+      (call-with-fds (list (tool 'mktdata) (number->string size))
+                    CLOSED_FD fd STDERR_FILENO)))
+  '(500 9000 32000 80000))
+
+(define (dearmor source-name sink-name)
+  (letfd ((source (open source-name (logior O_RDONLY O_BINARY)))
+           (sink (open sink-name (logior O_WRONLY O_CREAT O_BINARY) #o600)))
+          (call-with-fds `(,@GPG --dearmor) source sink STDERR_FILENO)))
+
+(for-each-p "Unpacking samples"
+  (lambda (name)
+    (dearmor (in-srcdir (string-append name "o.asc")) name))
+  '("plain-1" "plain-2" "plain-3" "plain-large"))
+
+;; XXX implement cleanup
+(catch '()
+       (mkdir "private-keys-v1.d" "-rwx"))
+
+(define counter (make-counter))
+(for-each-p' "Storing private keys"
+  (lambda (name)
+    (dearmor (in-srcdir (string-append "/privkeys/" name ".asc"))
+            (string-append "private-keys-v1.d/" name ".key")))
+  (lambda (name) (counter))
+  '("50B2D4FA4122C212611048BC5FC31BD44393626E"
+    "7E201E28B6FEB2927B321F443205F4724EBE637E"
+    "13FDB8809B17C5547779F9D205C45F47CE0217CE"
+    "343D8AF79796EE107D645A2787A9D9252F924E6F"
+    "8B5ABF3EF9EB8D96B91A0B8C2C4401C91C834C34"
+    "0D6F6AD4C4C803B25470F9104E9F4E6A4CA64255"
+    "FD692BD59D6640A84C8422573D469F84F3B98E53"
+    "76F7E2B35832976B50A27A282D9B87E44577EB66"
+    "A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD"
+    "00FE67F28A52A8AA08FFAED20AF832DA916D1985"
+    "1DF48228FEFF3EC2481B106E0ACA8C465C662CC5"
+    "A2832820DC9F40751BDCD375BB0945BA33EC6B4C"
+    "ADE710D74409777B7729A7653373D820F67892E0"
+    "CEFC51AF91F68A2904FBFF62C4F075A4785B803F"))
+
+(info "Importing public demo and test keys")
+(call-check `(,@GPG --yes --import
+                   ,(in-srcdir "pubdemo.asc")
+                   ,(in-srcdir "pubring.asc")))
+;; (letfd ((source (open (in-srcdir "pubring.pkr.asc") O_RDONLY)))
+;;        ((gpg-pipe '(--dearmor) '(--yes --import) STDERR_FILENO)
+;;     source CLOSED_FD))
+(pipe:do
+ (pipe:open (in-srcdir "pubring.pkr.asc") (logior O_RDONLY O_BINARY))
+ (pipe:spawn `(,@GPG --dearmor))
+ (pipe:spawn `(,@GPG --yes --import)))
+
+(info "Preset passphrases")
+;; one@example.com
+(call-check `(,(tool 'gpg-preset-passphrase)
+             --preset --passphrase def
+             "50B2D4FA4122C212611048BC5FC31BD44393626E"))
+(call-check `(,(tool 'gpg-preset-passphrase)
+             --preset --passphrase def
+             "7E201E28B6FEB2927B321F443205F4724EBE637E"))
+;; alpha@example.net
+(call-check `(,(tool 'gpg-preset-passphrase)
+             --preset --passphrase abc
+             "76F7E2B35832976B50A27A282D9B87E44577EB66"))
+(call-check `(,(tool 'gpg-preset-passphrase)
+             --preset --passphrase abc
+             "A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD"))
+
+(echo "All set up.")
diff --git a/tests/openpgp/signencrypt-dsa.scm b/tests/openpgp/signencrypt-dsa.scm
new file mode 100755 (executable)
index 0000000..baf1def
--- /dev/null
@@ -0,0 +1,48 @@
+#!/usr/bin/env gpgscm
+
+;; Copyright (C) 2016 g10 Code GmbH
+;;
+;; This file is part of GnuPG.
+;;
+;; GnuPG is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; GnuPG is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+(load (with-path "defs.scm"))
+
+(for-each-p
+ "Checking signing and encryption using DSA"
+ (lambda (source)
+   (tr:do
+    (tr:open source)
+    (tr:gpg usrpass1 `(--yes --passphrase-fd "0" -se
+                            -u ,dsa-usrname1
+                            --recipient ,dsa-usrname2))
+    (tr:gpg "" '(--yes))
+    (tr:assert-identity source)))
+ (append plain-files data-files))
+
+(define algos (if (have-hash-algo? "RIPEMD160")
+                 '("SHA1" "RIPEMD160")
+                 '("SHA1")))
+(for-each-p
+ "Checking signing and encryption using DSA with a specific hash algorithm"
+ (lambda (hash)
+   (tr:do
+    (tr:open (car plain-files))
+    (tr:gpg usrpass1 `(--yes --passphrase-fd "0" -se
+                            -u ,dsa-usrname1
+                            --recipient ,dsa-usrname2
+                            --digest-algo ,hash))
+    (tr:gpg "" '(--yes))
+    (tr:assert-identity (car plain-files))))
+ algos)
diff --git a/tests/openpgp/signencrypt.scm b/tests/openpgp/signencrypt.scm
new file mode 100755 (executable)
index 0000000..b138dce
--- /dev/null
@@ -0,0 +1,39 @@
+#!/usr/bin/env gpgscm
+
+;; Copyright (C) 2016 g10 Code GmbH
+;;
+;; This file is part of GnuPG.
+;;
+;; GnuPG is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; GnuPG is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+(load (with-path "defs.scm"))
+
+(for-each-p
+ "Checking signing and encryption"
+ (lambda (source)
+   (tr:do
+    (tr:open source)
+    (tr:gpg usrpass1 `(--yes --passphrase-fd "0" -se --recipient ,usrname2))
+    (tr:gpg "" '(--yes))
+    (tr:assert-identity source)))
+ (append plain-files data-files))
+
+(info "Checking bug 537: MDC problem with old style compressed packets.")
+(lettmp (tmp)
+  (call-popen `(,@GPG --yes --passphrase-fd "0"
+                     --output ,tmp ,(in-srcdir "bug537-test.data.asc"))
+             usrpass1)
+  (if (not (string=? "4336AE2A528FAE091E73E59E325B588FEE795F9B"
+                    (cadar (gpg-hash-string `(--print-md SHA1 ,tmp) ""))))
+      (error "bug537-test.data.asc: mismatch (bug 537)")))
diff --git a/tests/openpgp/sigs-dsa.scm b/tests/openpgp/sigs-dsa.scm
new file mode 100755 (executable)
index 0000000..bf5e415
--- /dev/null
@@ -0,0 +1,43 @@
+#!/usr/bin/env gpgscm
+
+;; Copyright (C) 2016 g10 Code GmbH
+;;
+;; This file is part of GnuPG.
+;;
+;; GnuPG is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; GnuPG is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+(load (with-path "defs.scm"))
+
+(for-each-p
+ "Checking signing using DSA with the default hash algorithm"
+ (lambda (source)
+   (tr:do
+    (tr:open source)
+    (tr:gpg "" `(--yes --sign --user ,dsa-usrname1))
+    (tr:gpg "" '(--yes))
+    (tr:assert-identity source)))
+ (append plain-files data-files))
+
+(define algos (if (have-hash-algo? "RIPEMD160")
+                 '("SHA1" "RIPEMD160")
+                 '("SHA1")))
+(for-each-p
+ "Checking signing using DSA with a specific hash algorithm"
+ (lambda (hash)
+   (tr:do
+    (tr:open (car plain-files))
+    (tr:gpg "" `(--yes --sign --user ,dsa-usrname1 --digest-algo ,hash))
+    (tr:gpg "" '(--yes))
+    (tr:assert-identity (car plain-files))))
+ algos)
diff --git a/tests/openpgp/sigs.scm b/tests/openpgp/sigs.scm
new file mode 100755 (executable)
index 0000000..c478231
--- /dev/null
@@ -0,0 +1,50 @@
+#!/usr/bin/env gpgscm
+
+;; Copyright (C) 2016 g10 Code GmbH
+;;
+;; This file is part of GnuPG.
+;;
+;; GnuPG is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; GnuPG is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+(load (with-path "defs.scm"))
+
+(for-each-p
+ "Checking signing with the default hash algorithm"
+ (lambda (source)
+   (tr:do
+    (tr:open source)
+    (tr:gpg "" '(--yes --sign))
+    (tr:gpg "" '(--yes))
+    (tr:assert-identity source)))
+ (append plain-files data-files))
+
+(for-each-p
+ "Checking signing with a specific hash algorithm"
+ (lambda (hash)
+   (if (have-pubkey-algo? "RSA")
+       ;; RSA key, so any hash is okay.
+       (tr:do
+       (tr:open (car plain-files))
+       (tr:gpg "" `(--yes --sign --user ,usrname3 --digest-algo ,hash))
+       (tr:gpg "" '(--yes))
+       (tr:assert-identity (car plain-files))))
+   (if (not (equal? "MD5" hash))
+       ;; Using the DSA sig key - only 160 bit or larger hashes
+       (tr:do
+       (tr:open (car plain-files))
+       (tr:gpg usrpass1
+               `(--yes --sign --passphrase-fd "0" --digest-algo ,hash))
+       (tr:gpg "" '(--yes))
+       (tr:assert-identity (car plain-files)))))
+ all-hash-algos)
diff --git a/tests/openpgp/use-exact-key.scm b/tests/openpgp/use-exact-key.scm
new file mode 100755 (executable)
index 0000000..bec537b
--- /dev/null
@@ -0,0 +1,68 @@
+#!/usr/bin/env gpgscm
+
+;; Copyright (C) 2016 g10 Code GmbH
+;;
+;; This file is part of GnuPG.
+;;
+;; GnuPG is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; GnuPG is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+(load (with-path "defs.scm"))
+
+;; Import the sample key
+;;
+;; pub   1024R/8BC90111 2015-12-02
+;;       Key fingerprint = E657 FB60 7BB4 F21C 90BB  6651 BC06 7AF2 8BC9 0111
+;; uid       [ultimate] Barrett Brown <barrett@example.org>
+;; sub   1024R/3E880CFF 2015-12-02 (encryption)
+;; sub   1024R/F5F77B83 2015-12-02 (signing)
+;; sub   1024R/45117079 2015-12-02 (encryption)
+;; sub   1024R/1EA97479 2015-12-02 (signing)
+
+(info "Importing public key.")
+(call-check
+ `(,(tool 'gpg) --import
+   ,(in-srcdir "samplekeys/E657FB607BB4F21C90BB6651BC067AF28BC90111.asc")))
+
+;; By default, the most recent, valid signing subkey (1EA97479).
+(for-each-p
+ "Checking that the most recent, valid signing subkey is used by default"
+ (lambda (keyid)
+   (tr:do
+     (tr:pipe-do
+      (pipe:defer (lambda (sink) (display "" (fdopen sink "w"))))
+      (pipe:gpg `(-s -u ,keyid))
+      (pipe:gpg '(--verify --status-fd=1)))
+     (tr:call-with-content
+      (lambda (c)
+       (unless (string-contains?
+                c "VALIDSIG 5FBA84ACE02DCB17DA3DFF6BBCA43C441EA97479")
+           (exit 1))))))
+ '("8BC90111" "3E880CFF" "F5F77B83" "45117079" "1EA97479"))
+
+;; But, if we request a particular signing key, we should get it.
+(for-each-p
+ "Checking that we can select a specific signing key"
+ (lambda (keyid)
+   (tr:do
+     (tr:pipe-do
+      (pipe:defer (lambda (sink) (display "" (fdopen sink "w"))))
+      (pipe:gpg `(-s -u ,(string-append keyid "!")))
+      (pipe:gpg '(--verify --status-fd=1)))
+     (tr:call-with-content
+      (lambda (c)
+       ;; XXX we do not have a regexp library
+       (unless (and (string-contains? c "VALIDSIG")
+                    (string-contains? c keyid))
+           (exit 1))))))
+ '("8BC90111" "F5F77B83" "1EA97479"))
diff --git a/tests/openpgp/verify.scm b/tests/openpgp/verify.scm
new file mode 100755 (executable)
index 0000000..de03db5
--- /dev/null
@@ -0,0 +1,274 @@
+#!/usr/bin/env gpgscm
+
+;; Copyright (C) 2016 g10 Code GmbH
+;;
+;; This file is part of GnuPG.
+;;
+;; GnuPG is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; GnuPG is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+(load (with-path "defs.scm"))
+
+;;
+;; Two simple tests to check that verify fails for bad input data
+;;
+(for-each-p
+ "Checking bogus signature"
+ (lambda (char)
+   (lettmp (x)
+     (pipe:do
+      (pipe:spawn `(,(tool 'mktdata) --char ,char "64"))
+      (pipe:write-to x (logior O_WRONLY O_CREAT O_BINARY) #o600))
+     (if (= 0 (call `(,@GPG --verify ,x data-500)))
+        (error "no error code from verify"))))
+ '("0x2d" "0xca"))
+
+;; A plain signed message created using
+;;  echo abc | gpg --homedir . --passphrase-fd 0 -u Alpha -z0 -sa msg
+(define msg_ols_asc "
+-----BEGIN PGP MESSAGE-----
+
+kA0DAAIRLXJ8x2hpdzQBrQEHYgNtc2dEDFJaSSB0aGluayB0aGF0IGFsbCByaWdo
+dC10aGlua2luZyBwZW9wbGUgaW4gdGhpcyBjb3VudHJ5IGFyZSBzaWNrIGFuZAp0
+aXJlZCBvZiBiZWluZyB0b2xkIHRoYXQgb3JkaW5hcnkgZGVjZW50IHBlb3BsZSBh
+cmUgZmVkIHVwIGluIHRoaXMKY291bnRyeSB3aXRoIGJlaW5nIHNpY2sgYW5kIHRp
+cmVkLiAgSSdtIGNlcnRhaW5seSBub3QuICBCdXQgSSdtCnNpY2sgYW5kIHRpcmVk
+IG9mIGJlaW5nIHRvbGQgdGhhdCBJIGFtLgotIE1vbnR5IFB5dGhvbgqIPwMFAEQM
+UlotcnzHaGl3NBECR4IAoJlEGTY+bHjD2HYuCixLQCmk01pbAKCIjkzLOAmkZNm0
+D8luT78c/1x45Q==
+=a29i
+-----END PGP MESSAGE-----
+")
+
+;; A plain signed message created using
+;;  echo abc | gpg --homedir . --passphrase-fd 0 -u Alpha -sa msg
+(define msg_cols_asc "
+-----BEGIN PGP MESSAGE-----
+
+owGbwMvMwCSoW1RzPCOz3IRxLSN7EnNucboLT6Cgp0JJRmZeNpBMLFFIzMlRKMpM
+zyjRBQtm5qUrFKTmF+SkKmTmgdQVKyTnl+aVFFUqJBalKhRnJmcrJOalcJVkFqWm
+KOSnKSSlgrSU5OekQMzLL0rJzEsEKk9JTU7NK4EZBtKcBtRRWgAzlwtmbnlmSQbU
+GJjxCmDj9RQUPNVzFZJTi0oSM/NyKhXy8kuAYk6lJSBxLlTF2NziqZCYq8elq+Cb
+n1dSqRBQWZKRn8fVYc/MygAKBljYCDIFiTDMT+9seu836Q+bevyHTJ0dzPNuvCjn
+ZpgrwX38z58rJsfYDhwOSS4SkN/d6vUAAA==
+=s6sY
+-----END PGP MESSAGE-----
+")
+
+;; A PGP 2 style message.
+(define msg_sl_asc "
+-----BEGIN PGP MESSAGE-----
+
+iD8DBQBEDFJaLXJ8x2hpdzQRAkeCAKCZRBk2Pmx4w9h2LgosS0AppNNaWwCgiI5M
+yzgJpGTZtA/Jbk+/HP9ceOWtAQdiA21zZ0QMUlpJIHRoaW5rIHRoYXQgYWxsIHJp
+Z2h0LXRoaW5raW5nIHBlb3BsZSBpbiB0aGlzIGNvdW50cnkgYXJlIHNpY2sgYW5k
+CnRpcmVkIG9mIGJlaW5nIHRvbGQgdGhhdCBvcmRpbmFyeSBkZWNlbnQgcGVvcGxl
+IGFyZSBmZWQgdXAgaW4gdGhpcwpjb3VudHJ5IHdpdGggYmVpbmcgc2ljayBhbmQg
+dGlyZWQuICBJJ20gY2VydGFpbmx5IG5vdC4gIEJ1dCBJJ20Kc2ljayBhbmQgdGly
+ZWQgb2YgYmVpbmcgdG9sZCB0aGF0IEkgYW0uCi0gTW9udHkgUHl0aG9uCg==
+=0ukK
+-----END PGP MESSAGE-----
+")
+
+;; An OpenPGP message lacking the onepass packet.  We used to accept
+;; such messages but now consider them invalid.
+(define bad_ls_asc "
+-----BEGIN PGP MESSAGE-----
+
+rQEHYgNtc2dEDFJaSSB0aGluayB0aGF0IGFsbCByaWdodC10aGlua2luZyBwZW9w
+bGUgaW4gdGhpcyBjb3VudHJ5IGFyZSBzaWNrIGFuZAp0aXJlZCBvZiBiZWluZyB0
+b2xkIHRoYXQgb3JkaW5hcnkgZGVjZW50IHBlb3BsZSBhcmUgZmVkIHVwIGluIHRo
+aXMKY291bnRyeSB3aXRoIGJlaW5nIHNpY2sgYW5kIHRpcmVkLiAgSSdtIGNlcnRh
+aW5seSBub3QuICBCdXQgSSdtCnNpY2sgYW5kIHRpcmVkIG9mIGJlaW5nIHRvbGQg
+dGhhdCBJIGFtLgotIE1vbnR5IFB5dGhvbgqIPwMFAEQMUlotcnzHaGl3NBECR4IA
+oJlEGTY+bHjD2HYuCixLQCmk01pbAKCIjkzLOAmkZNm0D8luT78c/1x45Q==
+=Mpiu
+-----END PGP MESSAGE-----
+")
+
+
+;; A signed message prefixed with an unsigned literal packet.
+;; (fols = faked-literal-data, one-pass, literal-data, signature)
+;; This should throw an error because running gpg to extract the
+;; signed data will return both literal data packets
+(define bad_fols_asc "
+-----BEGIN PGP MESSAGE-----
+
+rF1iDG1zZy51bnNpZ25lZEQMY0x0aW1lc2hhcmluZywgbjoKCUFuIGFjY2VzcyBt
+ZXRob2Qgd2hlcmVieSBvbmUgY29tcHV0ZXIgYWJ1c2VzIG1hbnkgcGVvcGxlLgqQ
+DQMAAhEtcnzHaGl3NAGtAQdiA21zZ0QMUlpJIHRoaW5rIHRoYXQgYWxsIHJpZ2h0
+LXRoaW5raW5nIHBlb3BsZSBpbiB0aGlzIGNvdW50cnkgYXJlIHNpY2sgYW5kCnRp
+cmVkIG9mIGJlaW5nIHRvbGQgdGhhdCBvcmRpbmFyeSBkZWNlbnQgcGVvcGxlIGFy
+ZSBmZWQgdXAgaW4gdGhpcwpjb3VudHJ5IHdpdGggYmVpbmcgc2ljayBhbmQgdGly
+ZWQuICBJJ20gY2VydGFpbmx5IG5vdC4gIEJ1dCBJJ20Kc2ljayBhbmQgdGlyZWQg
+b2YgYmVpbmcgdG9sZCB0aGF0IEkgYW0uCi0gTW9udHkgUHl0aG9uCog/AwUARAxS
+Wi1yfMdoaXc0EQJHggCgmUQZNj5seMPYdi4KLEtAKaTTWlsAoIiOTMs4CaRk2bQP
+yW5Pvxz/XHjl
+=UNM4
+-----END PGP MESSAGE-----
+")
+
+;; A signed message suffixed with an unsigned literal packet.
+;; (fols = faked-literal-data, one-pass, literal-data, signature)
+;; This should throw an error because running gpg to extract the
+;; signed data will return both literal data packets
+(define bad_olsf_asc "
+-----BEGIN PGP MESSAGE-----
+
+kA0DAAIRLXJ8x2hpdzQBrQEHYgNtc2dEDFJaSSB0aGluayB0aGF0IGFsbCByaWdo
+dC10aGlua2luZyBwZW9wbGUgaW4gdGhpcyBjb3VudHJ5IGFyZSBzaWNrIGFuZAp0
+aXJlZCBvZiBiZWluZyB0b2xkIHRoYXQgb3JkaW5hcnkgZGVjZW50IHBlb3BsZSBh
+cmUgZmVkIHVwIGluIHRoaXMKY291bnRyeSB3aXRoIGJlaW5nIHNpY2sgYW5kIHRp
+cmVkLiAgSSdtIGNlcnRhaW5seSBub3QuICBCdXQgSSdtCnNpY2sgYW5kIHRpcmVk
+IG9mIGJlaW5nIHRvbGQgdGhhdCBJIGFtLgotIE1vbnR5IFB5dGhvbgqIPwMFAEQM
+UlotcnzHaGl3NBECR4IAoJlEGTY+bHjD2HYuCixLQCmk01pbAKCIjkzLOAmkZNm0
+D8luT78c/1x45axdYgxtc2cudW5zaWduZWREDGNMdGltZXNoYXJpbmcsIG46CglB
+biBhY2Nlc3MgbWV0aG9kIHdoZXJlYnkgb25lIGNvbXB1dGVyIGFidXNlcyBtYW55
+IHBlb3BsZS4K
+=3gnG
+-----END PGP MESSAGE-----
+")
+
+
+;; Two standard signed messages in a row
+(define msg_olsols_asc_multiple "
+-----BEGIN PGP MESSAGE-----
+
+kA0DAAIRLXJ8x2hpdzQBrQEHYgNtc2dEDFJaSSB0aGluayB0aGF0IGFsbCByaWdo
+dC10aGlua2luZyBwZW9wbGUgaW4gdGhpcyBjb3VudHJ5IGFyZSBzaWNrIGFuZAp0
+aXJlZCBvZiBiZWluZyB0b2xkIHRoYXQgb3JkaW5hcnkgZGVjZW50IHBlb3BsZSBh
+cmUgZmVkIHVwIGluIHRoaXMKY291bnRyeSB3aXRoIGJlaW5nIHNpY2sgYW5kIHRp
+cmVkLiAgSSdtIGNlcnRhaW5seSBub3QuICBCdXQgSSdtCnNpY2sgYW5kIHRpcmVk
+IG9mIGJlaW5nIHRvbGQgdGhhdCBJIGFtLgotIE1vbnR5IFB5dGhvbgqIPwMFAEQM
+UlotcnzHaGl3NBECR4IAoJlEGTY+bHjD2HYuCixLQCmk01pbAKCIjkzLOAmkZNm0
+D8luT78c/1x45ZANAwACES1yfMdoaXc0Aa0BB2IDbXNnRAxSWkkgdGhpbmsgdGhh
+dCBhbGwgcmlnaHQtdGhpbmtpbmcgcGVvcGxlIGluIHRoaXMgY291bnRyeSBhcmUg
+c2ljayBhbmQKdGlyZWQgb2YgYmVpbmcgdG9sZCB0aGF0IG9yZGluYXJ5IGRlY2Vu
+dCBwZW9wbGUgYXJlIGZlZCB1cCBpbiB0aGlzCmNvdW50cnkgd2l0aCBiZWluZyBz
+aWNrIGFuZCB0aXJlZC4gIEknbSBjZXJ0YWlubHkgbm90LiAgQnV0IEknbQpzaWNr
+IGFuZCB0aXJlZCBvZiBiZWluZyB0b2xkIHRoYXQgSSBhbS4KLSBNb250eSBQeXRo
+b24KiD8DBQBEDFJaLXJ8x2hpdzQRAkeCAKCZRBk2Pmx4w9h2LgosS0AppNNaWwCg
+iI5MyzgJpGTZtA/Jbk+/HP9ceOU=
+=8nLN
+-----END PGP MESSAGE-----
+")
+
+;; A standard message with two signatures (actually the same signature
+;; duplicated).
+(define msg_oolss_asc "
+-----BEGIN PGP MESSAGE-----
+
+kA0DAAIRLXJ8x2hpdzQBkA0DAAIRLXJ8x2hpdzQBrQEHYgNtc2dEDFJaSSB0aGlu
+ayB0aGF0IGFsbCByaWdodC10aGlua2luZyBwZW9wbGUgaW4gdGhpcyBjb3VudHJ5
+IGFyZSBzaWNrIGFuZAp0aXJlZCBvZiBiZWluZyB0b2xkIHRoYXQgb3JkaW5hcnkg
+ZGVjZW50IHBlb3BsZSBhcmUgZmVkIHVwIGluIHRoaXMKY291bnRyeSB3aXRoIGJl
+aW5nIHNpY2sgYW5kIHRpcmVkLiAgSSdtIGNlcnRhaW5seSBub3QuICBCdXQgSSdt
+CnNpY2sgYW5kIHRpcmVkIG9mIGJlaW5nIHRvbGQgdGhhdCBJIGFtLgotIE1vbnR5
+IFB5dGhvbgqIPwMFAEQMUlotcnzHaGl3NBECR4IAoJlEGTY+bHjD2HYuCixLQCmk
+01pbAKCIjkzLOAmkZNm0D8luT78c/1x45Yg/AwUARAxSWi1yfMdoaXc0EQJHggCg
+mUQZNj5seMPYdi4KLEtAKaTTWlsAoIiOTMs4CaRk2bQPyW5Pvxz/XHjl
+=KVw5
+-----END PGP MESSAGE-----
+")
+
+;; A standard message with two one-pass packet but only one signature
+;; packet
+(define bad_ools_asc "
+-----BEGIN PGP MESSAGE-----
+
+kA0DAAIRLXJ8x2hpdzQBkA0DAAIRLXJ8x2hpdzQBrQEHYgNtc2dEDFJaSSB0aGlu
+ayB0aGF0IGFsbCByaWdodC10aGlua2luZyBwZW9wbGUgaW4gdGhpcyBjb3VudHJ5
+IGFyZSBzaWNrIGFuZAp0aXJlZCBvZiBiZWluZyB0b2xkIHRoYXQgb3JkaW5hcnkg
+ZGVjZW50IHBlb3BsZSBhcmUgZmVkIHVwIGluIHRoaXMKY291bnRyeSB3aXRoIGJl
+aW5nIHNpY2sgYW5kIHRpcmVkLiAgSSdtIGNlcnRhaW5seSBub3QuICBCdXQgSSdt
+CnNpY2sgYW5kIHRpcmVkIG9mIGJlaW5nIHRvbGQgdGhhdCBJIGFtLgotIE1vbnR5
+IFB5dGhvbgqIPwMFAEQMUlotcnzHaGl3NBECR4IAoJlEGTY+bHjD2HYuCixLQCmk
+01pbAKCIjkzLOAmkZNm0D8luT78c/1x45Q==
+=1/ix
+-----END PGP MESSAGE-----
+")
+
+;; Standard cleartext signature
+(define msg_cls_asc "
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+I think that all right-thinking people in this country are sick and
+tired of being told that ordinary decent people are fed up in this
+country with being sick and tired.  I'm certainly not.  But I'm
+sick and tired of being told that I am.
+- - Monty Python
+-----BEGIN PGP SIGNATURE-----
+
+iD8DBQFEDVp1LXJ8x2hpdzQRAplUAKCMfpG3GPw/TLN52tosgXP5lNECkwCfQhAa
+emmev7IuQjWYrGF9Lxj+zj8=
+=qJsY
+-----END PGP SIGNATURE-----
+")
+
+;; Cleartext signature with two signatures
+(define msg_clss_asc "
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+What is the difference between a Turing machine and the modern computer?
+It's the same as that between Hillary's ascent of Everest and the
+establishment of a Hilton on its peak.
+-----BEGIN PGP SIGNATURE-----
+
+iD8DBQFEDVz6LXJ8x2hpdzQRAtkGAKCeMhNbHnh339fpjNj9owsYcC4zBwCfYO5l
+2u+KEfXX0FKyk8SMzLjZ536IPwMFAUQNXPr+GAsdqeOwshEC2QYAoPOWAiQm0EF/
+FWIAQUplk7JWbyRKAJ92ZJyJpWfzb0yc1s7MY65r2qEHrg==
+=1Xvv
+-----END PGP SIGNATURE-----
+")
+
+;; Two clear text signatures in a row
+(define msg_clsclss_asc_multiple (string-append msg_cls_asc msg_clss_asc))
+
+;; Fixme:  We need more tests with manipulated cleartext signatures.
+
+;;
+;; Now run the tests.
+;;
+(for-each-p
+ "Checking that a valid signature is verified as such"
+ (lambda (armored-file)
+   (pipe:do
+    (pipe:echo (eval armored-file (current-environment)))
+    (pipe:spawn `(,@GPG --verify))))
+ '(msg_ols_asc msg_cols_asc msg_sl_asc msg_oolss_asc msg_cls_asc msg_clss_asc))
+
+(for-each-p
+ "Checking that a valid signature over multiple messages is verified as such"
+ (lambda (armored-file)
+   (pipe:do
+    (pipe:echo (eval armored-file (current-environment)))
+    (pipe:spawn `(,@GPG --verify --allow-multiple-messages)))
+   (catch '()
+         (pipe:do
+          (pipe:defer (lambda (sink)
+                        (display armored-file (fdopen sink "w"))))
+          (pipe:spawn `(,@GPG --verify)))
+         (error "verification succeded but should not")))
+ '(msg_olsols_asc_multiple msg_clsclss_asc_multiple))
+
+(for-each-p
+ "Checking that an invalid signature is verified as such"
+ (lambda (armored-file)
+   (catch '()
+         (pipe:do
+          (pipe:echo (eval armored-file (current-environment)))
+          (pipe:spawn `(,@GPG --verify)))
+         (error "verification succeded but should not")))
+ '(bad_ls_asc bad_fols_asc bad_olsf_asc bad_ools_asc))
diff --git a/tests/openpgp/version.scm b/tests/openpgp/version.scm
new file mode 100755 (executable)
index 0000000..dbcb484
--- /dev/null
@@ -0,0 +1,25 @@
+#!/usr/bin/env gpgscm
+
+;; Copyright (C) 2016 g10 Code GmbH
+;;
+;; This file is part of GnuPG.
+;;
+;; GnuPG is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; GnuPG is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+(load (with-path "defs.scm"))
+
+(info "Printing the GPG version")
+(assert (= 0 (call `(,@GPG --version))))
+
+;; fixme: check that the output is as expected