Last active
August 29, 2015 14:06
-
-
Save dwelch2344/2f4d2f493e65432ccaea to your computer and use it in GitHub Desktop.
OpenSSL RSA cert + private key encryption of files locally
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Generate our cert and key | |
openssl req -x509 -days 10000 -newkey rsa:2048 -keyout key.pem -out setup.crt -subj '/' | |
# Strip the password off the key | |
openssl rsa -in key.pem -out key.pem | |
# Encrypt our file | |
openssl smime -encrypt -aes256 -binary -outform PEM -in file.txt -out file.aes setup.crt | |
# Decrypt our file | |
openssl smime -decrypt -inform PEM -binary -in file.aes -inkey key.pem -out decrypted.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment