Skip to content

Latest commit

 

History

History
37 lines (23 loc) · 638 Bytes

openssl-enc.md

File metadata and controls

37 lines (23 loc) · 638 Bytes

Encrypt/decrypt files with OpenSSL

encrypt

Encrypt a single file:

openssl enc -aes-256-cbc -e -in <file> -out <file>.enc
cat <file> | openssl enc -aes-256-cbc -e > <file>.enc

Create an archive and encrypt:

tar cz <folder> | openssl enc -aes-256-cbc -e > <folder>.tar.gz.enc

decrypt

Decrypt a single file:

openssl enc -aes-256-cbc -d -in <file>.enc -out <file>.dec
cat <file>.enc | openssl enc -aes-256-cbc -d > <file>.dec

Decrypt and extract an archive:

openssl enc -aes-256-cbc -d -in <folder>.tar.gz.enc | tar xz

base64

To add base64-encoding/decoding, use -a.