reimplemented open
/close
/closeall
This commit is contained in:
parent
4f45f0aa89
commit
dc09f73159
1 changed files with 40 additions and 25 deletions
65
gpgtool
65
gpgtool
|
@ -146,6 +146,46 @@ list () {
|
|||
fi
|
||||
}
|
||||
|
||||
# Opens a key from the key path. Imports into temporary GPG and links the secret
|
||||
# key.
|
||||
open () {
|
||||
_checkinit
|
||||
|
||||
for id in $@
|
||||
do
|
||||
key=$(ls ${keypath}/${id}/*.key)
|
||||
[[ $? != 0 ]] && \
|
||||
echo "${id} does not seem to be a valid key folder, aborting …" && exit 1
|
||||
gpg --homedir "${tempdir}/gpghome" --import-options keep-ownertrust \
|
||||
--import "${keypath}/${id}/${id}.private.asc"
|
||||
[[ $? == 0 ]] && ln -sf ${key} ${tempdir}/gpghome/private-keys-v1.d/
|
||||
done
|
||||
}
|
||||
|
||||
# Closes a key from the key path. Deletes the secret key. does not delete the
|
||||
# actual key; that will be disposed of in the end anyway.
|
||||
close () {
|
||||
_checkinit
|
||||
|
||||
for id in $@
|
||||
do
|
||||
key=$(ls ${keypath}/${id}/*.key)
|
||||
[[ $? != 0 ]] && \
|
||||
echo "${id} does not seem to be a valid key folder, aborting …" && exit 1
|
||||
rm -f "${tempdir}/gpghome/private-keys-v1.d/$(basename ${key})"
|
||||
done
|
||||
}
|
||||
|
||||
# Closes all keys from the key path.
|
||||
closeall () {
|
||||
_checkinit
|
||||
|
||||
for key in $(ls ${keypath}/*/*.key)
|
||||
do
|
||||
rm -f "${tempdir}/gpghome/private-keys-v1.d/$(basename ${key})"
|
||||
done
|
||||
}
|
||||
|
||||
# Prints usage information.
|
||||
usage () {
|
||||
echo FIXXME
|
||||
|
@ -205,31 +245,6 @@ unmount () {
|
|||
sudo sync ${dev}
|
||||
}
|
||||
|
||||
# gpgtools open keyid [keyid …]
|
||||
open () {
|
||||
for id in $@
|
||||
do
|
||||
key=$(ls ${_dir}/${id: -8}*/*.key)
|
||||
ln -sf ${key} ${_pkdir}/
|
||||
done
|
||||
}
|
||||
# gpgtools close keyid [keyid …]
|
||||
close () {
|
||||
for id in $@
|
||||
do
|
||||
key=$(basename $(ls ${_dir}/${id: -8}*/*.key))
|
||||
rm -f ${_pkdir}/${key}
|
||||
done
|
||||
}
|
||||
# gpgtools closeall
|
||||
closeall () {
|
||||
for key in $(ls ${_dir}/*/*.key)
|
||||
do
|
||||
key=$(basename ${key})
|
||||
rm -f ${_pkdir}/${key}
|
||||
done
|
||||
}
|
||||
|
||||
# 1. create a new key then
|
||||
# 2. do this with the FULL key id!
|
||||
# gpgtools init fullid name
|
||||
|
|
Loading…
Reference in a new issue