diff --git a/.bashrc b/.bashrc index d7b8ad6..de2ff51 100644 --- a/.bashrc +++ b/.bashrc @@ -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 #--------------------------------------------------------------------------------