Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rdkls/e74ada39a2f90357b72ccc51a0d8856b to your computer and use it in GitHub Desktop.
Save rdkls/e74ada39a2f90357b72ccc51a0d8856b to your computer and use it in GitHub Desktop.
openssl genrsa -out key.pem
openssl rsa -in key.pem -pubout -out key.pub
Now you'll have pub + private keys
You can send the pub key to supplying user, who can then encrypt with it, and you can decrypt
To encrypt:
echo "xxxxxxxx" | openssl rsautl -encrypt -inkey ./key.pub -pubin | base64
To decrypt:
echo "my_b64_string==" | base64 -d | openssl rsautl -decrypt -inkey key.pem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment