Add function to decrypt secrets.
This commit is contained in:
parent
c6c67daf91
commit
a0cfe41380
15
.bashrc
15
.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
|
||||
#--------------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in a new issue