How to encrypt and decrypt a file with openssl

Openssl comes with lots of cipher types. At the end of the post you can find a list of all cipher types.

Encryption

We want to encrypt the file test.txt with AES 256 Bit CBC. The name of the encrypted file is test.enc:

openssl enc -aes-256-cbc -in test.txt -out test.enc

Decryption

We want to decrypt the file test.enc with AES 256 Bit CBC:

openssl enc -d -aes-256-cbc -in test.enc -out test.txt

Openssl will ask you for the passphrase.

List of all cipher types:

-aes-128-cbc
-aes-128-cfb
-aes-128-cfb1
-aes-128-cfb8
-aes-128-ecb
-aes-128-ofb              
-aes-192-cbc
-aes-192-cfb
-aes-192-cfb1
-aes-192-cfb8
-aes-192-ecb
-aes-192-ofb
-aes-256-cbc
-aes-256-cfb
-aes-256-cfb1
-aes-256-cfb8
-aes-256-ecb
-aes-256-ofb
-aes128
-aes192
-aes256
-bf
-bf-cbc
-bf-cfb
-bf-ecb
-bf-ofb
-blowfish
-cast
-cast-cbc
-cast5-cbc
-cast5-cfb
-cast5-ecb
-cast5-ofb
-des
-des-cbc
-des-cfb
-des-cfb1
-des-cfb8
-des-ecb
-des-ede
-des-ede-cbc
-des-ede-cfb
-des-ede-ofb
-des-ede3
-des-ede3-cbc
-des-ede3-cfb
-des-ede3-ofb
-des-ofb
-des3
-desx
-desx-cbc
-rc2
-rc2-40-cbc
-rc2-64-cbc
-rc2-cbc
-rc2-cfb
-rc2-ecb
-rc2-ofb
-rc4
-rc4-40

Last update: 14.06.2015

Advertisements

Posted on April 18, 2012, in Cryptography and tagged . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: