Difference between revisions of "OpenSSL/Cheatsheet"

From braindump
Jump to navigation Jump to search
Line 4: Line 4:
|-
|-
! Type !! Action !! Command !! Comment
! Type !! Action !! Command !! Comment
|-
| Help || List || <tt>openssl list-standard-commands</tt> ||
|-
|-
| Base64 || Encode || <tt>openssl base64 -in <span class="input"><INPUT>.txt</span> -out <span class="input"><OUTPUT>.b64</span></tt> ||
| Base64 || Encode || <tt>openssl base64 -in <span class="input"><INPUT>.txt</span> -out <span class="input"><OUTPUT>.b64</span></tt> ||

Revision as of 13:08, 10 July 2012

Command line shortcuts

Type Action Command Comment
Help List openssl list-standard-commands
Base64 Encode openssl base64 -in <INPUT>.txt -out <OUTPUT>.b64
Base64 Decode openssl base64 -d -in <File>.b64 -out <File>.txt
MD5 Checksum openssl md5 <File> Same as md5sum <File>
SHA1 Checksum openssl sha1 <File> Same as sha1sum <File>
SHA224 Checksum openssl sha224 <File> Same as sha224sum <File>
SHA256 Checksum openssl sha256 <File> Same as sha256sum <File>
SHA384 Checksum openssl sha384 <File> Same as sha384sum <File>
SHA512 Checksum openssl sha512 <File> Same as sha512sum <File>
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

  1. 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: