Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GNUPG how to encrypt file without it's original extension in the name?

Tags:

gnupg

I need to automatically encrypt file e.g. myfile.xls to myfile.gpg. Now when I'm trying to encrypt it automatically or with GNU privacy assistent, the encrypted file is myfile.xls.gpg. When I delete that .xls, it has no extension after decrypting. Thank you.

like image 647
culter Avatar asked Sep 04 '25 16:09

culter


1 Answers

That gpgencrypt.c option looks like far too much effort.

To encrypt do this:

gpg -er $recipient_id -o myfile.gpg myfile.xls

To decrypt and restore the original filename do this:

gpg --use-embedded-filename -d myfile.gpg

That name has been encrypted and is stored with the encrypted data. That flag tells GPG to use the original filename instead of creating a new filename based on the name of the encrypted file.

like image 93
Ben Avatar answered Sep 07 '25 17:09

Ben