3

I'm trying to encrypt a file as well as its filename. Encrypting the file is fairly easy, I use gpg for that, but I can't figure out how to encrypt the filename as well. Would be great if the filename could be encrypted using the same key.

Any idea on how to do this?

4
  • 1
    gpg isn't an option for this as even short messages (e.g. filenames) will end up in quite long encrypted text that will be longer then 255 bytes (max filename length) for any useful key length.
    – Sven
    May 17, 2015 at 23:24
  • 3
    Consider an encrypted directory or even the whole disk. May 17, 2015 at 23:28
  • How about doing it manually? May 18, 2015 at 13:35
  • Or put the file in archive w generic name and encrypt that
    – Petter H
    May 19, 2015 at 9:31

2 Answers 2

2

ecryptfs.org

ecryptfs can encrypt both the file contents and the file names. It's the default home directory encryption scheme supported by Ubuntu.

1

If you are already using gpg, I would advise you the following process:

  1. Create a directory with a meaningless name (eg. use mktemp -d).

  2. Copy your file(s) into this directory.

  3. Encrypt and compress the archive of this directory with gpg:

    gpg-zip -c -o file.gpg dirname
    

You may want to write a shell script to automate this easily.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .