This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# TODO: this leaks the session key to arguments visible to ps while decrypting | |
set -euo pipefail | |
# if an argument was provided, use it as the path to the rsa private key, otherwise assume openssh | |
keypath=${1:-"$HOME/.ssh/id_rsa"} | |
# deal with converting openssh special file format to something openssl understands | |
TMPFILE=$(mktemp) | |
cp -p "$keypath" $TMPFILE |