Change Passphrase in Batch Mode

Werner Koch wk at gnupg.org
Thu Mar 17 10:25:36 CET 2022


On Wed, 16 Mar 2022 09:26, Daniel Kilimnik said:

> mode. With --pinentry-mode loopback --passphrase-fd 0 activated. It asks
> for my current passphrase, but then exits with a success.

--passphrase-fd works only if a password is request but not if two
passwords are quested (the old one and the new one).  You need to use
the --command-fd thingy and write a state machine for this.  Here is a
manual example

--8<---------------cut here---------------start------------->8---
$ gpg --pinentry-mode loopback --status-fd 2 -v --batch --command-fd 0  --passwd FE894309B6844A3004FE8BF9476CAB1C3623CAA6
[GNUPG:] KEY_CONSIDERED FE894309B6844A3004FE8BF9476CAB1C3623CAA6 0
[GNUPG:] INQUIRE_MAXLEN 100
[GNUPG:] GET_HIDDEN passphrase.enter
abc
[GNUPG:] GOT_IT
[GNUPG:] INQUIRE_MAXLEN 100
[GNUPG:] GET_HIDDEN passphrase.enter
def
[GNUPG:] GOT_IT
[GNUPG:] SUCCESS keyedit.passwd
--8<---------------cut here---------------end--------------->8---


Salam-Shalom,

   Werner

-- 
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 227 bytes
Desc: not available
URL: <https://lists.gnupg.org/pipermail/gnupg-users/attachments/20220317/080ea6b8/attachment.sig>


More information about the Gnupg-users mailing list