Created
December 8, 2023 04:37
-
-
Save tashrifbillah/dbd8d1e5d8e8500211a26a099bf4981b to your computer and use it in GitHub Desktop.
Commands for encrypting and decrypting a message using SSH's public/private key pair
This file contains 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
#!/bin/bash | |
# convert SSH public key to pem format | |
ssh-keygen -e -m PKCS8 -f git_rsa.pub > git_rsa.pem | |
# encrypt | |
openssl rsautl -encrypt -pubin -inkey git_rsa.pem -in message.txt -out message.enc | |
# decrypt | |
openssl rsautl -decrypt -inkey git_rsa -in message.enc | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Putting it up here for future Googlers.