Skip to content

Instantly share code, notes, and snippets.

@mattmaddux
Created July 20, 2020 17:50
Show Gist options
  • Save mattmaddux/bef8d02e2d917e5900a4ca85e5776127 to your computer and use it in GitHub Desktop.
Save mattmaddux/bef8d02e2d917e5900a4ca85e5776127 to your computer and use it in GitHub Desktop.
#!/bin/bash
PASS="$1"
KEY="$2"
BEFORE="$HOME/tmp-before.pem"
AFTER="$HOME/tmp-after.pem"
echo "$KEY" > ~/tmp-before.pem
openssl rsa -aes256 -in "$BEFORE" -passout pass:"$PASS" -out "$AFTER"
KEY=$(cat "$AFTER")
rm "$BEFORE"
rm "$AFTER"
echo $KEY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment