====== Crypto - Fu ====== Decrypt MD5 wget -qO - --post-data "data[Row][cripted]=1cb251ec0d568de6a929b520c4aed8d1" \ http://md5-decrypter.com/ | grep -A1 "Decrypted text" | tail -n1 | \ cut -d '"' -f3 | sed 's/>//g; s/<\/b//g' Create named LUKS encrypted volume edrv() { N=${1:-edrv}; truncate -s ${2:-256m} $N.img && L=$(losetup -f) \ && losetup $L $N.img && cryptsetup luksFormat --batch-mode $L \ && cryptsetup luksOpen $L $N \ && mkfs.vfat /dev/mapper/$N -n $N; \ cryptsetup luksClose $N; \ echo losetup -d $L to unmount; } A simple way to securely use passwords on the command line or in scripts wget --input-file=~/donwloads.txt --user="$USER" \ --password="$(gpg2 --decrypt ~/.gnupg/passwd/http-auth.gpg 2>/dev/null)" Check site ssl certificate dates echo | openssl s_client -connect www.google.com:443 2>/dev/null \ |openssl x509 -dates -noout Convert a PKCS\#8 private key to PEM format openssl pkcs8 -inform DER -nocrypt -in [priv key] -out [pem priv key] Debug openssl from CLI openssl s_client -state -connect site.com:443 Encrypted archive with openssl and tar openssl des3 -salt -in unencrypted-data.tar -out encrypted-data.tar.des3 Encrypted archive with openssl and tar tar --create --file - --posix --gzip -- DIR | openssl enc -e -aes256 -out FILE Encrypt text to md5 wget -qO - --post-data "data[Row][clear]=text" http://md5-encryption.com \ | grep -A1 "Md5 encrypted state" | tail -n1 | cut -d '"' -f3 \ | sed 's/>//g; s/<\/b//g' Encrypt your file using RC4 encryption hashkey=''echo -ne | xxd -p''; openssl rc4 -e -nosalt -nopad \ -K $hashkey -in myfile.txt -out myfile.enc.txt Extract public key from private openssl rsa -in key.priv -pubout > key.pub How to determine SSL cert expiration date from a PEM encoded openssl x509 -enddate -noout -in file.pem Identify a PKCS\#8 Private Key openssl ans1parse -inform DER < [priv key] New ssl key and csr based on a previous ssl certificate regenerateCSR () { openssl genrsa -out $2 2048; openssl x509 -x509toreq -in $1 -out $3 -signkey $2; } OpenSSL one line CSR & Key generation openssl req -nodes -newkey rsa:2048 -keyout server.key -out server.csr -subj \ "/C=BR/ST=State/L=City/O=Company Inc./OU=IT/CN=domain.com" Output a SSL certificate start or end date date --date="$(openssl x509 -in xxxxxx.crt -noout -startdate | cut -d= -f 2)" \ --iso-8601 Quickly generate an MD5 hash for a text string using OpenSSL echo -n 'text to be encrypted' | openssl md5 Simple multi-user encrypted chat server for 5 users ncat -vlm 5 --ssl --chat 9876 Test for Weak SSL Ciphers openssl s_client -connect [host]:[sslport] -cipher LOW View acceptable client certificate CA names asked for during SSL renegotiations openssl s_client -connect www.example.com:443 -prexit Connect to SMTP server using STARTTLS openssl s_client -starttls smtp -crlf -connect 127.0.0.1:25 Convert .ppk file to .ssh file puttygen my_ssh_key.ppk -O private-openssh -o my_openssh_key.ssh Create a P12 file, using OpenSSL openssl pkcs12 -export -in /dir/CERTIFICATE.pem -inkey /dir/KEY.pem \ -certfile /dir/CA-cert.pem -name "certName" -out /dir/certName.p12