X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/distorted-keys/blobdiff_plain/2661d8aa033971c32f45392fc70e42f0d9a2c14e..2235222bb9739a1e6713b49290906c5b4cf08f04:/keys.list-recov diff --git a/keys.list-recov b/keys.list-recov new file mode 100755 index 0000000..38ab00f --- /dev/null +++ b/keys.list-recov @@ -0,0 +1,80 @@ +#! /bin/sh +### +### List the available recovery keys +### +### (c) 2012 Mark Wooding +### + +###----- Licensing notice --------------------------------------------------- +### +### This file is part of the distorted.org.uk key management suite. +### +### distorted-keys is free software; you can redistribute it and/or modify +### it under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2 of the License, or +### (at your option) any later version. +### +### distorted-keys is distributed in the hope that it will be useful, +### but WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +### GNU General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with distorted-keys; if not, write to the Free Software Foundation, +### Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +set -e +case "${KEYSLIB+t}" in t) ;; *) echo >&2 "$0: KEYSLIB unset"; exit 1 ;; esac +. "$KEYSLIB"/keyfunc.sh + +defhelp <&1 "$quis: no recovery keys" +else + cd $KEYS/recov + firstp=t + for r in $(find . -type l -name current -print); do + r=${r#./}; r=${r%/current} + if ! expr >/dev/null "Q$r" : "Q$R_LABEL"; then continue; fi + unset ri + case $firstp in t) firstp=nil ;; nil) echo ;; esac + echo "$r" + echo " keepers" + while read k t; do + read n hunoz <$KEYS/keeper/$k/meta + echo " $k t=$t n=$n" + done <$r/keepers + rcur=$(readlink $r/current) + for ri in $r/*; do + i=${ri##*/} + case "$i" in *[!0-9]*) continue ;; esac + echo " instance $i" + case "$rcur" in $i) echo " current" ;; esac + readmeta $ri/store + nubid=$(cat $ri/store/nubid) + echo " profile $profile" + echo " nubid $nubid" + echo " keepers" + for kp in $ri/*.param; do + k=${kp##*/}; k=${k%.param} + read n hunoz <$KEYS/keeper/$k/meta + t=$(sharethresh $kp) + echo " $k t=$t n=$n" + done + anyp=nil + for sf in $(cd $ri; find . -type f -name '*.recov' -print); do + s=${sf#./} + case $anyp in nil) anyp=t; echo " secrets" ;; esac + echo " $s" + done + done + done +fi + +###----- That's all, folks --------------------------------------------------