4

I encrypted a folder with this command:

tar -zcf - rails_project | openssl des3 -salt -k 123456 | dd of=rails.tar.gz

Attached it to a mail, press send, and voila, error message that I can't attach executable files. How in the world can Gmail know what's inside!?

2
  • 3
    Normally, when you encrypt an archive, only the contents of the archived files are encrypted, but the names of the files and folder are visible. I don't use tar, but if it's anything like ZIP/RAR/7Z/etc., you need to set another option to encrypt the filenames as well as their contents.
    – Synetech
    Jun 22, 2012 at 17:24
  • @Synetech tar is not like zip/rar/7z, where there's a table of contents. Even if it were, the analogy here would be passing the entire zip/rar/7z as a binary blob into a separate encryption program (openssl in this case), which would encrypt the entire thing, headers and all.
    – jjlin
    Jun 22, 2012 at 20:10

3 Answers 3

9

See this Gmail help page: Some file types are blocked

I'm guessing the "Gmail does not allow you to send or receive files that are corrupted" part is what applies here (but the Gmail programmer neglected to give a more specific error message for this case). That is, Gmail is checking your .tar.gz file and finding that it's invalid.

I'd suggest using a different extension so Gmail doesn't think it's a corrupt tarball. I just tested this hypothesis, and it seems to be correct. I used the .gpg extension, though I'm sure any number of extensions not on their blacklist would work just as well.

0

Use a different algorithm. All des3 encrypted files I tested triggered a false positive on Gmail's executable checks. When I used aes-256-cbc however they went through.

1
  • I was not able to replicate this behavior. Encrypting with either des3 and aes-256-cbc resulted in Gmail complaining that there was an executable file. Renaming the same files to use a different extension (I picked .gpg) made them go through.
    – jjlin
    Jun 22, 2012 at 20:37
0

It checks the extension.

It will permit you to attach program.exee

6
  • The attachment is a tar.gz.
    – JohannesM
    Jun 22, 2012 at 17:04
  • @JohannesM: So? It looks inside archives.
    – Loren Pechtel
    Jun 22, 2012 at 17:08
  • @LorenPechtel - The archive is encrypted.
    – Ramhound
    Jun 22, 2012 at 17:15
  • 1
    Okay, the file may encrypted, but maybe not the headers. The headers containing the complete filename of each item in the tar.
    – JohannesM
    Jun 22, 2012 at 17:21
  • Since you're encrypting the entire .tar.gz file, the headers are encrypted as well. In any case, the tar format doesn't have any "table of contents" that indicates the complete filename of every file in the tar archive.
    – jjlin
    Jun 22, 2012 at 17:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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