GPG --version
gpg (GnuPG) 2.2.23 libgcrypt 1.8.6 Copyright (C) 2020 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later https://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
Home: C:/Users/Mujtaba - VT/AppData/Roaming/gnupg Supported algorithms: Pubkey: RSA, ELG, DSA, ECDH, ECDSA, EDDSA Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH, CAMELLIA128, CAMELLIA192, CAMELLIA256 Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224 Compression: Uncompressed, ZIP, ZLIB, BZIP2
options provided during encryption by application: --batch --no-tty --pinentry-mode loopback --decrypt [ file ]
in light of above, i'm expecting gpg-agent to gather password from my gpg.conf file. Question is that can it be stored encrypted or read from an encrypted file by the agent without any human intervention?
Sample Implementation using CMD in Windows:
@echo off && cd /d "%~dp0"
set "_gpg=gpg.exe --batch --yes --pinentry-mode loopback --passphrase"
for /f "usebackq delims=" %%i in (`%___AppDir__%where.exe .:*.zip.gpg
`)do %_gpg% "mypassword" --output "%%~dpi%%~ni" --decrypt "%%~i"
The following (untested) code should do the job.
Create a .bat file within the folder, paste the following into it and run it:
for %%i in (*.gpg) do (
set "file=%%i"
gpg --batch --yes --pinentry-mode loopback --passphrase "mypassword" --output "%file:.gpg=%" --decrypt "%%i"
)
Currently i'm using the following values on GPG.CONF (that was not created with default installation)
default-recipient MyTestKeyPairName passphrase MyClearPassword