chiark / gitweb /
Import gnupg2_2.1.17.orig.tar.bz2
[gnupg2.git] / tests / fake-pinentries / fake-pinentry.pl
1 #!/usr/bin/perl -w
2 # Use this for your test suites when a perl interpreter is available.
3 #
4 # The encrypted keys in your test suite that you expect to work must
5 # be locked with a passphrase of "passphrase"
6 #
7 # Author: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
8 #
9 # License: Creative Commons Zero ("Public Domain Dedication") --
10 # Anyone may reuse it, modify it, redistribute it for any purpose.
11
12 use strict;
13 use warnings;
14
15 # turn off buffering
16 $| = 1;
17
18 print "OK This is only for test suites, and should never be used in production\n";
19 while (<STDIN>) {
20   chomp;
21   next if (/^$/);
22   next if (/^#/);
23   print ("D passphrase\n") if (/^getpin/i);
24   print "OK\n";
25   exit if (/^bye/i);
26 }
27 1;