Search code examples
encryptionopensslfile-format

How to open a .txt.enc file?


I have a .txt.enc file. When I try to open it in a text editor like Emacs, I get an arbitrary number of characters and numbers. It is encrypted, actually. I also have tried the openssl command line tools, but they don't give the correct result either.

Does anybody know how I can open such a file?


Solution

  • It looks like the file is encrypted or encoded somehow, but the obvious question is, how?

    If program used to encrypt the file is a fairly common one, and if it includes a known header in its output, then the Unix file command might be able to recognize it. If not, it may come down to guesswork.

    Note that the file might not actually be encrypted with a secret key: it seems that the .enc extension is sometimes used e.g. for uuencoded files, which are just binary files encoded as ASCII text, very similar to base64 encoding. The file command definitely ought to recognize those, though.

    If the file is encrypted, though, then even after finding the software used to encrypt it, you'll still have a bigger problem: finding the correct key. If the encryption is any good, the only way (assuming you don't know the key already) to do that will be to all possible keys by brute force. If the key is based on a password, and if the password is fairly weak (i.e. very short and/or common, like "abc123"), it might be possible to find it using a brute-force password cracker. But I wouldn't hold my breath.

    (Of course, if the file is encrypted and you don't know the password, the next obvious question is, how did you end up with the file, anyway?)