I'm executing GPG as DOS commands in C#. Works in majority. I've managed reading passwords from standard input (similarly to written here)
But I've stuck on keys deletion what you need is execute below command:
gpg --delete-key "Key Name"
But problem is GPG asks you if you are sure you want to delete this key and what you
need is press Y < ENTER > what I'm not able to archive...
Seems it doesn't read from StdIO
I've tried DOS-like solution
echo Y | gpg --delete-key "Key Name"
or making txt file with Y as 1st line and < Enter > as 2nd
type yes.txt | gpg --delete-key "Key Name"
Both didnt work...
Any idea how to make it working ??
Try to pass --yes
as a param.
From the GPG manual:
--delete-key name
Remove key from the public keyring. In batch mode either
--yes
is required or the key must be specified by fingerprint. This is a safeguard against accidental deletion of multiple keys.