[DECRYPT AN OPENSSL .ENC FILE]

Files made with openssl enc or CryptoJS, decrypted in your browser with their password.

Last updated

Many .enc files are made with the openssl enc command — in backup scripts, CI pipelines and tutorials — or with CryptoJS in web apps. They start with the 8 bytes Salted__ (or U2FsdGVkX1 once Base64-encoded). Drop one below and enter its password: the right settings are detected automatically and the file is decrypted on your device, without OpenSSL installed.

[IDENTIFY A FILE]

Only the first 1 MB and the last 64 KB are read, inside your browser. Nothing is uploaded.

[WHAT WORKS]

  • Ciphers: aes-256-cbc (OpenSSL's usual choice) and aes-128-cbc.
  • Key derivation: -pbkdf2 (any -iter count), and the legacy password hashing of OpenSSL 1.0 (-md md5) and OpenSSL 1.1+ without -pbkdf2 (-md sha256).
  • Encodings: binary files and Base64 (-a), including the strings produced by CryptoJS.AES.encrypt(text, password).

Not supported: files made with -nosalt or with a raw -K/-iv key, aes-192 (browsers do not implement it), and other ciphers such as CTR, GCM, DES or ChaCha20. Use the OpenSSL command line for those.

[WHY "BAD DECRYPT" HAPPENS]

The file records the salt but not how the password was turned into a key, so the decrypting side has to use the same options as the encrypting side. Three mismatches cause almost every bad decrypt error:

  • The default changed in OpenSSL 1.1.0. Before it, openssl enc derived keys with MD5; since then it uses SHA-256. A file made on an old server needs -md md5 on a new one.
  • -pbkdf2 on one side only. It must be used for both encryption and decryption, with the same -iter count (10,000 when not given).
  • A different cipher. A file encrypted with -aes-128-cbc will not open with -aes-256-cbc.

The tool above tries every cipher and key derivation for you and shows the matching command once it succeeds. It only tries the default PBKDF2 count of 10,000, so if the file was made with a custom -iter (scripts often use 100,000 or more), open Settings and type that number.

[DOING IT ON THE COMMAND LINE]

# Modern files (OpenSSL 1.1.1+ with -pbkdf2)
openssl enc -d -aes-256-cbc -pbkdf2 -in file.enc -out file

# Files made by OpenSSL 1.1.0+ without -pbkdf2
openssl enc -d -aes-256-cbc -md sha256 -in file.enc -out file

# Files made by OpenSSL 1.0.x, and CryptoJS output (add -a for Base64)
openssl enc -d -aes-256-cbc -md md5 -a -in message.txt -out message

OpenSSL is preinstalled on macOS and Linux. On Windows it comes with Git for Windows (in Git Bash).

[WHAT IS INSIDE THE FILE]

The openssl enc format is minimal. It stores no cipher name, no iteration count and no original filename, which is why decrypting it means guessing settings:

Bytes Content
0–7The ASCII text Salted__. In Base64 form (-a or CryptoJS) the file starts with U2FsdGVkX1 instead.
8–15A random 8-byte salt, mixed with the password to produce the key and the IV.
16–endAES-CBC ciphertext with PKCS#7 padding, so its length is always a multiple of 16 bytes. A size that is not means the file was cut short in transit.

The IV is not stored: it is derived from the password and salt along with the key. That is also why a file made with -nosalt, or with an explicit -K key and -iv, cannot be opened from a password alone.

[FILES THAT LOOK SIMILAR BUT ARE NOT OPENSSL ENC]

  • Starts with $ANSIBLE_VAULT;1.1;AES256: an Ansible Vault file. Open it with ansible-vault view file and the vault password.
  • Starts with -----BEGIN PGP MESSAGE----- or the binary bytes 85/8C: GnuPG. Use gpg -d file; it may need a private key rather than a password.
  • Starts with -----BEGIN PKCS7----- or made with openssl smime / openssl cms: encrypted to a certificate. Only the matching private key opens it, not a password.
  • Starts with ENCF: a CryptFile.Online file. Decrypt it on the .enc decryption page.

When unsure, drop the file in the box above: it recognises Ansible Vault, GnuPG and CryptFile files and says so instead of asking for a password.

[AFTER DECRYPTING: THE FILE HAS NO EXTENSION]

openssl enc does not record the original name, so the result often arrives as file or with the wrong extension. Look at its first bytes to name it:

  • 1F 8B: gzip. Backup scripts often run tar czf - folder | openssl enc -aes-256-cbc -pbkdf2 -out backup.tar.gz.enc, so rename it .tar.gz and extract it.
  • PK: a ZIP archive, which is also what .docx, .xlsx and .apk files are.
  • %PDF: a PDF. FF D8 FF: a JPEG. 89 50 4E 47: a PNG.
  • SQLite format 3: a SQLite database. Plain readable text is often a .sql dump or a .env file.

If the start is still random bytes, the settings were wrong even though decryption reported success; see the FAQ below.

[HOW TO DECRYPT AN OPENSSL .ENC FILE ONLINE]

Decrypt a file made with openssl enc or CryptoJS, in your browser.

  1. Drop the file. Choose the .enc file, or a .txt file containing CryptoJS / openssl -a output. It is not uploaded.
  2. Enter the password. Type the password used to encrypt it and press Decrypt.
  3. Save the result. The decrypted file downloads automatically. The matching openssl command is shown in case you need it again.

[FREQUENTLY ASKED QUESTIONS]

Is the file or password sent anywhere?

No. Decryption uses your browser's built-in Web Crypto API. The file and password stay on your device.

Can it decrypt an OpenSSL file without the password?

No. AES with a reasonable password cannot be broken, and the password is not stored in the file. Without it, the file cannot be opened by this tool or any other.

How do I know my .enc file came from OpenSSL?

Open it in a text or hex editor: an OpenSSL file starts with the characters Salted__. If it starts with ENCF it came from CryptFile.Online; anything else came from another program, and the encrypted file identifier will tell you which.

The download is garbage. What went wrong?

Very occasionally a wrong combination of settings passes the padding check. Open Settings, choose the key derivation and cipher you believe were used, and decrypt again.