Skip to content

Instantly share code, notes, and snippets.

@gvych
Created February 27, 2019 16:34
Show Gist options
  • Save gvych/f0a897fd816402b2309f0f554e2630c8 to your computer and use it in GitHub Desktop.
Save gvych/f0a897fd816402b2309f0f554e2630c8 to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment