I have some PDF files I need to store safely on my Mac (MacBook Air 2011, OSX Lion). I've done a quick search on encryption software, and what I found left me with a couple of questions. First about the encryption software: it seems it encrypts your files using an algorithm of choice, and I'm wondering which is the safest one? And how safe is it actually? Because my (basic) understanding of encryption (PHP password encryption, etc...) tells me that if the encrypted file can be decrypted again, it's not that safe by definition (The algorithm can be "reversed".) So what's the safest way to go about this?

Another thing. I found some people who use the Terminal to hide files by putting a dot before the filename, so it doesn't show up in the normal user interface. This seems very weird to me, because it shows up in the Terminal nonetheless. If you guys could point me in the right direction, that would be much appreciated!

6 Answers 6


Your best option, as you said, is to do both, i.e. encrypt a file, and then hide it. The best option is to use a disk image, which can be used as a directory in the Finder, for easy access (when mounted).

Create a DMG image using "Disk Utility" (it's in /Applications/Utilities/, or use Spotlight). For this, click File > New > Blank Disk Image. Then you can choose the size (select it large enough to fit your needs) and the encryption (128- or 256-bit AES). Give it a name and a storing location, and there you go.

Using Terminal, you can then rename the file using (assuming the image was saved in your documents folder)

mv ~/Documents/myImage.dmg ~/Documents/.myImage

Every time you need to access your image, you can do, from Terminal,

open ~/Documents/.myImage

You will be prompted for your password, and then you can use the disk image just like usual in the Finder. You can use whatever name you want.

To be safer, you need to clear your history so that no one can see the command you typed to open the image (which reveals its location)

history -c && rm -f ~/.bash_history

Also, when the image is unmounted, make sure to delete its link on the left pane of Disk Utility.

  • 1
    An easier way to prevent a single command from being entered in the history is to precede it with a space. Another option to prevent an entire session to be saved is to use the command HISTFILE= (which tells the shell to save its history ... nowhere). Jan 21, 2012 at 18:52
  • @GordonDavisson: Indeed. Good point! Thanks for mentioning this.
    – Karolos
    Jan 21, 2012 at 19:55

Steganography is a poor way to keep things safe. While it may add a layer of protection keeping files on you computer safe from non-technical users, it provides zero security against anyone else. Most forensic applications search raw data for file headers and analyze file sizes - among other things. So, for example, if you were to hide a pdf file in a jpg, this would be useless against someone searching for pdf headers. (It would probably also stick out to have a 25MB image that was 320px by 320px...) Essentially, stenography is useless in modern computing against modern forensic techniques. Also, adding the "." before a file doesn't hide it, it only allows filters that filter out dot files to filter them out. You can still find those files if you ask for them specifically.

As far as the strength of AES, Blowfish, Rijndael, or whatever else - they are only of limited security. Regardless of what anyone tells you, these algorithms are not unbreakable nor were they ever designed to be unbreakable. You're correct in saying that encryption (generally) relays on an algorithm that can be reversed; however, to reverse them it requires a significant amount to processing effort - more than is currently possible or probable to calculate the primes and retrieve the original key.

A good way to think about encryption is to ask yourself, "How much is my data worth?" and "How much effort would someone else put in to getting it?".

If you're trying to hide nuclear launch codes, then popping them in to a text file in a password protected zip file isn't good enough.

The only encryption that is considered by many to be uncrackable is the One Time Pad.

So, how do I hide my stuff?

I would recommend that you download Truecrypt and create a large container that is suitable to hold all of your files you want to hide - then add 30%-50%. Once you've created the container, fill it 30%-50% with files that someone else might think are important, but are worthless. These files will act as your diversion files - a decoy if you're ever forced to reveal your password.

Once you have that set up, create another hidden container within the first. This is where you will put your super secret files. (Refer to the Truecrypt docs to find out how to do this - it's easy.)

Finally, rename your file with a different file extension to throw people off the trail. The .dmg extension on OS X is good for this - or even .iso. Again, this is of limited use, but makes some people feel better.

Now you have a pretty secure container that hides your files and if you're ever put in a situation to reveal your password, you can reveal the password to you decoy partition and no one would be able to prove otherwise. Rumor has it that the FBI wasn't able to crack a Truecrypt container even after 2 years.

Now if you really want to take things to the next level. Get a USB with a passcode, and use FileVault2 to encrypt your USB and put your Truecrypt container on the USB.

I also have a moat with rabid sharks, but YMMV...


hiding files it not comparable to encryption.

Currently AES ist the standard encryption Algorithm and is very secure, it is as secure as the password you use. It can only be decrypted by guessing your password. Make sure you do not use ECB mode, but no serious Program even offers this encryption mode.

In MacOSX it is easy to create a encrypted DMG file with the "Disk Utility" with "New Image".


The security of encryption is almost always based around a secret (normally a key or password) - not the encryption algorithm itself which is usually public knowledge.

Choose a standardised algorithm and a strong (not easily guessable) password and you're away. AES is a good choice - it's used by Governments, etc.

You always need to be able to decrypt an encrypted file - otherwise how would you ever read it?! The point of encryption is that decrypting the file correctly requires knowledge of the secret.

There's a huge difference between hiding and encrypting a file. Hiding (obfiscation) can never be relied on to be secure - someone will always find your data. Encrypting means that an attacker cannot read the data even if they find the file.

  • Thanx for your answer! By the way, I know that hiding a file en encryption are totally different things, but I want to encrypt the file securely, and then hide that encrypted file;).
    – Stefan Hagen
    Jan 21, 2012 at 13:02
  • Well, then encrypt it, put it on a medium like flash drive or CD and hide that medium, probably somewhere surrounded by moat with sharks. Or under your pillow. The concept of .hiding on unix is solely to get the boring stuff off of your sight :) Jan 22, 2012 at 4:21

About hidden files

The dot-before-file name trick is just a standard Unix convention: a file name starting with a dot is a hidden file which should not be shown through the user interfaces. However, in most of these UIs there is a way to make these files seen. Using the trick may hide the file from most people, but may make it much more obvious to computer gurus.

About encryption

Modern encryption are based on mathematical hypotheses that a certain class of operations cannot be easily undo unless you know exactly how they're done in the first place. This prevents reverse engineering and crypt-analysis. Thus encryption algorithms can be standardized and published for public scrutiny.

To still protect your data, the steps in the algorithms accepts parameters which are derived from a encryption key. A decryption algorithm will also be provided that will only work if the original encryption key is given. If the wrong key is used, the decrypted text will be gibberish. Most of these encryption algorithm suites also comes with mathematical proofs that no other practical algorithms can be used to decrypt the data without knowing the encryption key.

About hasing

A secure hash function is a one-way function, i.e. can't be reversed, with some extra guarantees on its properties. They are not really used for "encryption" but for "proof".

The method you used to "encrypt" passwords in PHP is probably a hash function and it's not really encryption because as you know the point is the hashed data cannot be decrypted.

People often confuse the two because a) many ciphers can be used as hashing functions and b) hashing is also used in encryption suites to make it more secure.

More on b): Hashing is most often used to treat encryption keys to make the input uniform and avoid known weakness. Thus in more professional encryption software, you'll often be given a choice on both the encryption algorithm (AES, RC4, etc.) and the hash algorithm (MD5, SHA, etc.)

However, you obviously cannot use a hash function to encrypt things because the point of useful encryption is that you can get the clear text back.

To make these knowledge practical

... you'll have to think carefully about who you're trying to hide the data from, how good are their computer skills and will the data be worth it for them to get an expert.

If you can accept people finding the encrypted files but still not be able to open them, any encryption software will probably do. If you want denial of existence, i.e. people cannot prove you have the encrypted file without you giving up the knowledge, you may look into TrueCrypt.


Adobe Acrobat itself will allow you to set passwords on the document. You can restrict someone from opening the file at all without a password, or allow viewing but not copying or printing, etc.

In Acrobat X - select Tools...Protection..Encrypt to encrypt the file with a password, or with a certificate.

One note - the better password you choose - the harder it will be to 'crack.'

I'd recommend requiring a password to open the file, as PDF's encrypted to that level are much harder to crack than those that allow any user to open the file.

The benefit of encrypting the file itself vs. the .DMG method is that it can be opened on any platform that can read PDF's and supports the Encryption scheme.

Your Answer

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