OpenSSL/Cheatsheet
Command line shortcuts
Type | Action | Command | Comment |
---|---|---|---|
Base64 | Encode | openssl base64 -in <INPUT>.txt -out <OUTPUT>.b64 | |
Base64 | Decode | openssl base64 -d -in <INPUT>.b64 -out <OUTPUT>.txt | |
MD5 | Checksum | openssl md5 <INPUT> | Same as md5sum <INPUT> |
SHA1 | Checksum | openssl sha1 <INPUT> | Same as sha1sum <INPUT> |
SHA224 | Checksum | openssl sha224 <INPUT> | Same as sha224sum <INPUT> |
SHA256 | Checksum | openssl sha256 <INPUT> | Same as sha256sum <INPUT> |
SHA384 | Checksum | openssl sha384 <INPUT> | Same as sha384sum <INPUT> |
SHA512 | Checksum | openssl sha512 <INPUT> | Same as sha512sum <INPUT> |
Password | Encrypt | openssl passwd <Password> | Creates a crypt-ed password for use with /etc/shadow [1] |
Password | Encrypt | openssl passwd -1 <Password> | Creates a md5 password for use with /etc/shadow [1] |
_= Notes ==
- Newer versions of Debian use the sha-512 there is a tool called mkpasswd that will create compatible passwords.
File encryption
Encrypt
openssl enc -aes-256-cbc < <File> > <File>.aes enter aes-256-cbc encryption password: Verifying - enter aes-256-cbc encryption password:
Decrypt
openssl enc -d -aes-256-cbc -in <File>.aes > <File> enter aes-256-cbc decryption password: