chiark / gitweb /
gnupg2 (2.1.17-3) unstable; urgency=medium
[gnupg2.git] / tests / fake-pinentries / fake-pinentry.php
1 #!/usr/bin/php
2 <?php
3 # Use this for your test suites when a PHP interpreter is available.
4 #
5 # The encrypted keys in your test suite that you expect to work must
6 # be locked with a passphrase of "passphrase"
7 #
8 # Author: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
9 #
10 # License: Creative Commons Zero ("Public Domain Dedication") --
11 # Anyone may reuse it, modify it, redistribute it for any purpose.
12
13 print("OK This is only for test suites, and should never be used in production\n");
14 while (true) {
15     $line = fgets(STDIN);
16     if (False === $line)
17         break;
18     $line = strtolower(trim($line));
19     if (($line === "") || ($line[0] == '#'))
20         continue;
21     if ((0 === strncmp("getpin", $line, 6)))
22         print("D passphrase\n");
23     print("OK\n");
24     if ((0 === strncmp("bye", $line, 3)))
25         break;
26 }
27 ?>