I do not want to run something like gpg -c as it prompts me for a passphrase. I will have cron job that backs-up and encypts some files. I want to pass in a location to a private key (via arguements) to an application that can encrypt a stream (ie: instead of encrypting just a file, it can use the pipe character, |, as input).

Symmetric encryption like AES or the like is preferred.

One more thing, I want it to be a private key that I store somewhere on the file system. Not a private key that is managed by a key server or some kind of application specific key container.


Then use gpg -c --passphrase-file=... or gpg -c --passphrase-fd=.... For example:

dmesg | gpg -c --passphrase-fd=3 --batch > dmesg.txt.gpg 3< zombies.key

To decrypt:

gpg --batch --passphrase-fd=3 3< zombies.key --output decrypted.txt --decrypt dmesg.txt.gpg

(I think gpg does default to CAST, though, so also add --cipher-algo AES256.)

Alternatively, openssl cipher -aes256.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.