Developing a command line utility to provision PGP master key and subkeys and move subkeys to YubiKey security key.
When one runs following, I believe one can only supply single passphrase using passphrase-fd… but one also needs to supply YubiKey admin PIN.
echo -e "key 1\nkeytocard\n1\nkey 1\nkey 2\nkeytocard\n2\nkey 2\nkey 3\nkeytocard\n3\nsave" | gpg \ --command-fd 0 \ --passphrase-fd 3 \ --pinentry-mode loopback \ --edit-key 313E4740E10DE4EE\ 3<<<"foo"
Same limitation applies to scripting YubiKey user and admin PIN changes using gpg --change-pin where one needs to supply current and new PIN.
Is there a workaround? If not, supporting above use cases would be very useful when automating PGP/YubiKey provisioning at enterprise scale.
My goal is to generate passphrase and PINs randomly and only query first name, last name and email from user.
yubikey-prov.sh --first-name "John" --last-name "Doe" --email "johndoe@example.net"
Thanks for helping out!