Difference between revisions of "OpenSSL/Cheatsheet"

From braindump
Jump to navigation Jump to search
Line 21: Line 21:


MD5 (for /etc/passwd and /etc/shadow)
MD5 (for /etc/passwd and /etc/shadow)
openssl passwd -1
openssl passwd -1 <span class="input"><Password></span>

'''Note:''' Newer versions of Debian use the sha-512 there is a tool called <tt>mkpasswd</tt> that will create compatible passwords.


=== File encryption ===
=== File encryption ===

Revision as of 00:16, 30 June 2012

Command line shortcuts

Base64

Encode

openssl base64 < file.b64 > file.txt

Decode

openssl base64 -d < file.txt > file.b64

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: