chiark / gitweb /
Import gnupg2_2.1.17.orig.tar.bz2
[gnupg2.git] / tests / fake-pinentries / fake-pinentry.sh
1 #!/bin/sh
2 # Use this for your test suites when a POSIX shell 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 echo "OK This is only for test suites, and should never be used in production"
13 while read cmd rest; do
14     cmd=$(printf "%s" "$cmd" | tr 'A-Z' 'a-z')
15     if [ -z "$cmd" ]; then
16         continue;
17     fi
18     case "$cmd" in
19         \#*)
20         ;;
21         getpin)
22             echo "D passphrase"
23             echo "OK"
24             ;;
25         bye)
26             echo "OK"
27             exit 0
28             ;;
29         *)
30             echo "OK"
31             ;;
32     esac
33 done