Add function to decrypt secrets.

This commit is contained in:
Scott Wallace 2016-02-18 08:03:43 +00:00
parent c6c67daf91
commit a0cfe41380

15
.bashrc
View file

@ -8,6 +8,21 @@ pathadd() {
} }
#-------------------------------------------------------------------------------- #--------------------------------------------------------------------------------
#--------------------------------------------------------------------------------
# Decrypt stored keys
#--------------------------------------------------------------------------------
getkey() {
KEYFILE=~/.keys/${1}
if [ -f ${KEYFILE} ]; then
PASS=$(security find-internet-password -l ssh:scott@wallace.sh -gw)
openssl rsautl -decrypt -inkey ~/.ssh/scott@wallace.sh -passin "pass:${PASS}" -in ${KEYFILE} 2>/dev/null
else
echo "No such key" >&2
fi
}
#--------------------------------------------------------------------------------
#-------------------------------------------------------------------------------- #--------------------------------------------------------------------------------
# The best editor # The best editor
#-------------------------------------------------------------------------------- #--------------------------------------------------------------------------------