1
0
Fork 0
mirror of synced 2024-12-22 06:31:07 -05:00
yadm/test/pinentry-mock

20 lines
504 B
Text
Raw Normal View History

#!/bin/bash
# This program is a custom mock pinentry program
# It uses whatever password is found in the /tmp directory
# If the password is empty, replies CANCEL causing an error to similate invalid
# credentials
echo "OK Pleased to meet you"
while read -r line; do
if [[ $line =~ GETPIN ]]; then
password="$(cat "$GNUPGHOME/mock-password" 2>/dev/null)"
if [ -n "$password" ]; then
echo "D $password"
echo "OK";
else
echo "CANCEL";
fi
else
echo "OK";
fi
done