Difference between revisions of "OpenSSL/Cheatsheet"

From braindump
Jump to navigation Jump to search
m (Uroesch moved page OpenSSL to OpenSSL/Cheatsheet)
Line 1: Line 1:
== Command line shortcuts ==
== Command line shortcuts ==
=== Base64 ===
Encode
openssl base64 < file.b64 > file.txt


{| class="wikitable sortable collapsible"
Decode
|-
openssl base64 -d < file.txt > file.b64
! Type !! Action !! Command !! Comment
|-
| Base64 || Encode || <tt>openssl base64 -in <span class="input"><INPUT>.txt</span> -out <span class="input"><OUTPUT>.b64</span></tt> ||
|-
| Base64 || Decode || <tt>openssl base64 -d -in <span class="input"><INPUT>.b64</span> -out <span class="input"><OUTPUT>.txt</span></tt> ||
|-
| MD5 || Checksum || <tt>openssl md5 <span class="input"><INPUT></span> </tt> || Same as <tt>md5sum <span class="input"><INPUT></span></tt>
|-
| SHA1 || Checksum || <tt>openssl sha1 <span class="input"><INPUT></span> </tt> || Same as <tt>sha1sum <span class="input"><INPUT></span></tt>
|-
| SHA224 || Checksum || <tt>openssl sha224 <span class="input"><INPUT></span> </tt> || Same as <tt>sha224sum <span class="input"><INPUT></span></tt>
|-
| SHA256 || Checksum || <tt>openssl sha256 <span class="input"><INPUT></span> </tt> || Same as <tt>sha256sum <span class="input"><INPUT></span></tt>
|-
| SHA384 || Checksum || <tt>openssl sha384 <span class="input"><INPUT></span> </tt> || Same as <tt>sha384sum <span class="input"><INPUT></span></tt>
|-
| SHA512 || Checksum || <tt>openssl sha512 <span class="input"><INPUT></span> </tt> || Same as <tt>sha512sum <span class="input"><INPUT></span></tt>
|-
|}


=== MD5 ===
=== MD5 ===

Revision as of 08:50, 10 July 2012

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>

MD5

Checksum a file

openssl md5 file

SHA1

Checksum a file

openssl sha1 file


Generate Passwords

Crypt

openssl passwd <Password>

MD5 (for /etc/passwd and /etc/shadow)

openssl passwd -1 <Password>

Note: 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: