Skip to content

Instantly share code, notes, and snippets.

@wipfli
Last active August 15, 2022 15:58
Show Gist options
  • Save wipfli/b2836347ed50d73ec5492ef58f3c8baf to your computer and use it in GitHub Desktop.
Save wipfli/b2836347ed50d73ec5492ef58f3c8baf to your computer and use it in GitHub Desktop.

Send me a secret

If you want to send me a secret like a password or some login details, follow these steps on an ubuntu machine:

echo "<your-secret-password>" > secretfile.txt
openssl rand -out secret.key 32
openssl aes-256-cbc -in secretfile.txt -out secretfile.txt.enc -pass file:secret.key
curl https://github.com/wipfli.keys > recipients-key.pub
openssl rsautl -encrypt -oaep -pubin -inkey <(ssh-keygen -e -f recipients-key.pub -m PKCS8) -in secret.key -out secret.key.enc
rm secret.key

Send me two files:

  • secretfile.txt.enc
  • secret.key.enc

How I will decrypt it

openssl rsautl -decrypt -oaep -inkey ~/.ssh/import-thinkpad/github_oliver/github_oliver -in secret.key.enc -out secret.key
openssl aes-256-cbc -d -in secretfile.txt.enc -out secretfile.txt -pass file:secret.key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment