--- /dev/null
+#! /bin/bash
+# Dummy pinentry
+#
+# Copyright 2008 g10 Code GmbH
+#
+# This file is free software; as a special exception the author gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+#
+# This file is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE.
+
+echo OK Your orders please
+
+while read cmd; do
+ case $cmd in
+ GETPIN) echo D test0123456789; echo OK;;
+ *) echo OK;;
+ esac
+done
require-secret-key)
&rest body)
"Set up temporary locations and variables for testing."
- (declare (indent 1))
- `(let ((epg-tests-home-directory (make-temp-file "epg-tests-homedir" t)))
+ (declare (indent 1) (debug (sexp body)))
+ `(let ((epg-tests-home-directory (make-temp-file "epg-tests-homedir" t))
+ (process-environment (cons "GPG_AGENT_INFO" process-environment)))
(unwind-protect
(let ((context (epg-make-context 'OpenPGP)))
(setf (epg-context-program context)
`'require-passphrase))))
(setf (epg-context-home-directory context)
epg-tests-home-directory)
- (setenv "GPG_AGENT_INFO")
,(if require-passphrase
- `(epg-context-set-passphrase-callback
- context
- #'epg-tests-passphrase-callback))
+ `(with-temp-file (expand-file-name
+ "gpg-agent.conf" epg-tests-home-directory)
+ (insert "pinentry-program "
+ (expand-file-name "dummy-pinentry"
+ epg-tests-data-directory)
+ "\n")
+ (epg-context-set-passphrase-callback
+ context
+ #'epg-tests-passphrase-callback)))
,(if require-public-key
`(epg-import-keys-from-file
context