change passphrase in batch mode

Werner Koch wk at gnupg.org
Tue Jul 30 14:28:49 CEST 2013


On Tue, 30 Jul 2013 12:57, mailinglisten at hauke-laging.de said:

> I am limited to the content of Knoppix (which is 1.4.x). Is it possible to 
> write a pinentry wrapper in shell code (again: limited to what Knoppix

Sure.  Here is a very basic one:

  #!/bin/sh
  # Copyright 2011 Free Software Foundation, Inc.
  # This file is free software; as a special exception the author gives
  # unlimited permission to copy and/or distribute it, with or without
  # modifications, as long as this notice is preserved.  This file is
  # distributed in the hope that it will be useful, but WITHOUT ANY
  # WARRANTY, to the extent permitted by law; without even the implied
  # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  
  echo "OK - what's up?"
  while read cmd rest; do
    echo "cmd=$cmd rest=$rest" >&2
    case "$cmd" in
      \#*)
        ;;
      GETPIN)
        echo "D ${PINENTRY_USER_DATA}"
        echo "OK"
        ;;
      BYE)
        echo "OK"
        exit 0
        ;;
      *)
        echo "OK"
        ;;
    esac
  done

It simply echos the content of the envvar PINENTRY_USER_DATA which is
passed from gpg to via gpg-agent to the pinentry.  A more useful script
would use this variable to convey control information to the script.



Shalom-Salam,

   Werner


-- 
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.




More information about the Gnupg-users mailing list