I have used the following command to symmetrically encrypt different files, all with the same passphrase:

$ gpg -c --s2k-cipher-algo AES256 --s2k-digest-algo SHA512 --s2k-count 65536 some_file.txt

The use case is that these encrypted files are never shared, and only meant to be decrypted on my machine. I am using gpg-agent to cache passphrases for a certain time duration.

First question; am I correct that gpg-agent caches passphrases per encrypted file? In other words, it seems caching of the passphrase by gpg-agent works, but only per file, not per passphrase?

To be able to use the same passphrase for encrypting multiple files, without having to re-enter the same passphrase multiple times initially, I now encrypt a single passphrase file, and then use

$ gpg -d ~/.key.gpg | gpg -q -d --batch --passphrase-fd 0 ...

for every encrypted file to ensure I only need to enter the passphrase once per session. Any issues with this approach except for the fact that only one passphrase is used?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.