[feat]: save
function
This commit is contained in:
parent
a9c95b8838
commit
59bbcb140b
1 changed files with 22 additions and 0 deletions
22
gpgtool
22
gpgtool
|
@ -219,6 +219,28 @@ create () {
|
||||||
echo "----- Restoring secret key for further modification …"
|
echo "----- Restoring secret key for further modification …"
|
||||||
ln -sf ${keypath}/${id}/${keygrip}.key ${tempdir}/gpghome/private-keys-v1.d/
|
ln -sf ${keypath}/${id}/${keygrip}.key ${tempdir}/gpghome/private-keys-v1.d/
|
||||||
echo "----- Remember to import / send & close when done!"
|
echo "----- Remember to import / send & close when done!"
|
||||||
|
|
||||||
|
# FIXXE: add /info file!
|
||||||
|
}
|
||||||
|
|
||||||
|
# (Re-)exports an open key after editing.
|
||||||
|
save () {
|
||||||
|
_checkinit
|
||||||
|
|
||||||
|
id=${1}
|
||||||
|
|
||||||
|
echo "----- Removing secret key …"
|
||||||
|
keygrip=$(gpg --homedir "${tempdir}/gpghome" --with-keygrip --list-key ${id} | grep Keygrip | head -n 1 | awk {'print $3'})
|
||||||
|
rm ${tempdir}/gpghome/private-keys-v1.d/${keygrip}.key
|
||||||
|
echo "----- Exporting …"
|
||||||
|
exdir="${keypath}/${id}/$(date +%F)"
|
||||||
|
mkdir -p $exdir
|
||||||
|
gpg --homedir "${tempdir}/gpghome" --armor --export-secret-keys ${id} > ${keypath}/${id}/${id}.private.asc
|
||||||
|
gpg --homedir "${tempdir}/gpghome" --armor --export ${id} > ${keypath}/${id}/${id}.public.asc
|
||||||
|
cp ${keypath}/${id}/${id}.*.asc ${exdir}
|
||||||
|
echo "----- Restoring secret key …"
|
||||||
|
ln -sf ${keypath}/${id}/${keygrip}.key ${tempdir}/gpghome/private-keys-v1.d/
|
||||||
|
echo -e "\nYou probably want to \`gpgtool import ${id}\` to load the updated key into your regular keyring."
|
||||||
}
|
}
|
||||||
|
|
||||||
# Extends an open key.
|
# Extends an open key.
|
||||||
|
|
Loading…
Reference in a new issue