summaryrefslogtreecommitdiffstats
path: root/tests/fake-pinentries/fake-pinentry.php
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 09:59:15 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 09:59:15 +0000
commit8de1ee1b2b676b0d07586f0752750dd6b0fb7511 (patch)
treedd46fd7dc3863045696cd0e48032d8a36fa0daf5 /tests/fake-pinentries/fake-pinentry.php
parentInitial commit. (diff)
downloadgnupg2-8de1ee1b2b676b0d07586f0752750dd6b0fb7511.tar.xz
gnupg2-8de1ee1b2b676b0d07586f0752750dd6b0fb7511.zip
Adding upstream version 2.2.27.upstream/2.2.27upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/fake-pinentries/fake-pinentry.php')
-rwxr-xr-xtests/fake-pinentries/fake-pinentry.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/fake-pinentries/fake-pinentry.php b/tests/fake-pinentries/fake-pinentry.php
new file mode 100755
index 0000000..bc4088f
--- /dev/null
+++ b/tests/fake-pinentries/fake-pinentry.php
@@ -0,0 +1,27 @@
+#!/usr/bin/php
+<?php
+# Use this for your test suites when a PHP interpreter is available.
+#
+# The encrypted keys in your test suite that you expect to work must
+# be locked with a passphrase of "passphrase"
+#
+# Author: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
+#
+# License: Creative Commons Zero ("Public Domain Dedication") --
+# Anyone may reuse it, modify it, redistribute it for any purpose.
+
+print("OK This is only for test suites, and should never be used in production\n");
+while (true) {
+ $line = fgets(STDIN);
+ if (False === $line)
+ break;
+ $line = strtolower(trim($line));
+ if (($line === "") || ($line[0] == '#'))
+ continue;
+ if ((0 === strncmp("getpin", $line, 6)))
+ print("D passphrase\n");
+ print("OK\n");
+ if ((0 === strncmp("bye", $line, 3)))
+ break;
+}
+?>