gvych
2/27/2019 - 4:34 PM

encrypt text using ssh-keys

encrypt text using ssh-keys

Encrypt:
echo secure message to send | openssl rsautl -encrypt -oaep -pubin -inkey <(ssh-keygen -e -f ~/.ssh/id_rsa.pub -m PKCS8) | base64
O4O4V...PawicXqomdrY71Qxw==

Decrypt:
echo 'O4O4V...PawicXqomdrY71Qxw==' | base64 -d  | openssl rsautl -decrypt -oaep -inkey ~/.ssh/id_rsa
Enter pass phrase for .ssh/id_rsa:
secure message to send