SSL Encryption/Decryption – Quick Cheat Sheet

## Generate Private Key
openssl genrsa -out private-key.pem 8196
 
## Generate Public Key using above Private Key
openssl rsa -in private-key.pem -out public-key.pem -outform PEM -pubout
 
## Encrypt a file named file.txt to a file named file.txt.encrypted
openssl rsautl -encrypt -inkey public-key.pem -pubin -in file.txt -out file.txt.encrypted
 
## Dectrypt an encrypted file named file.txt.encrypted to a file named file.txt.decrypted
openssl rsautl -decrypt -inkey private-key.pem -in file.txt.encrypted -out file.txt.decrypted

Add a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Comments