Skip to content

Instantly share code, notes, and snippets.

@nekopanic
Created December 11, 2015 03:38
Show Gist options
  • Save nekopanic/0a78cf7b705a9bb9ec1f to your computer and use it in GitHub Desktop.
Save nekopanic/0a78cf7b705a9bb9ec1f to your computer and use it in GitHub Desktop.
Poor man's encryption

Say you have someones public key at pubkey.pub:

$ echo "potato" | openssl rsautl -encrypt -pubin -inkey <(ssh-keygen -f pubkey.pub -e -m PKCS8) -ssl | openssl base64

Now send the result to them, e.g. message.txt, and they have their private key at ~/.ssh/id_rsa

$ cat message.txt | openssl base64 -d | openssl rsautl -decrypt -inkey ~/.ssh/id_rsa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment