When you decrypt a file with GnuPG with the -d option and the file is in ascii form, it simply scrolls down the screen and can be read. But what if it isn't an ascii file that was encrypted, but say a Word file (foo.doc.gpg). So I end up with a decrypted binary file (foo.doc) that scrolls down the screen, but is still unreadable.

What I'm asking, is there a single command using gpg -d... where the output is then read by Libre Office, which translates the .doc file to readable form which then scrolls down - ie I don't wish to save this file at any point to my hard drive if I can help it, owing to its sensitive data and possible security risk.

gpg -d /EncryptDir/foo.doc.gpg>foo && libreoffice foo && shred fooallows me to read the file as normal, and is then shredded once I close Libre Office, but it is temporarily saved to my drive while it is open (being read). Is there a more direct solution avoiding the temporary saving of foo?

  • Not a solution, but with the save-to-file scenario, how do you know you actually shred all the copies of the decrypted file? LibreOffice may well store it in a temporary file somewhere too. This might be an issue if you make LibreOffice read from a pipe somehow (which it doesn't seem to be able to do as far as I can see).
    – Kusalananda
    Mar 10, 2019 at 17:29
  • what about libreoffice <(gpg -d /EncryptDir/foo.doc.gpg ) ? (I didn't test it, so I couldn't write as an answer)/
    – Archemar
    Mar 10, 2019 at 17:31
  • @ Archemar. That doesn't work. It says error: cannot find file <(gpg -d...) Mar 10, 2019 at 18:02
  • @Kusalananda. Don't see what you mean. There is only one copy made by gpg when it decrypts a file - unless you are implying Libre Office makes hidden copies when it opens and closes files. Mar 10, 2019 at 18:07
  • @PaulBenson Many editors, including Vim for example, will save temporary data to disk while you are viewing and/or editing a file.
    – Kusalananda
    Mar 10, 2019 at 19:14


You must log in to answer this question.

Browse other questions tagged .