X-Git-Url: https://git.distorted.org.uk/~mdw/distorted-keys/blobdiff_plain/600916867dd4f7e6129f8c1ebbc84134fbf9f9f2..2661d8aa033971c32f45392fc70e42f0d9a2c14e:/keyfunc.sh.in diff --git a/keyfunc.sh.in b/keyfunc.sh.in index 0256dc0..a618e66 100644 --- a/keyfunc.sh.in +++ b/keyfunc.sh.in @@ -557,6 +557,31 @@ c_sysverify () { c_sysop verify "$1" /dev/null; } ###-------------------------------------------------------------------------- ### Recovery operations. +sharethresh () { + pf=$1 + ## Return the sharing threshold from the parameter file PARAM. + + read param <"$pf" + case "$param" in + shamir-params:*) ;; + *) + echo >&2 "$quis: secret sharing parameter file damaged (wrong header)" + exit 1 + ;; + esac + t=";${param#*:}" + case "$t" in + *";t="*) ;; + *) + echo >&2 "$quis: secret sharing parameter file damaged (missing t)" + exit 1 + ;; + esac + t=${t#*;t=} + t=${t%%;*} + echo "$t" +} + stash () { recov=$1 label=$2 ## Stash a copy of stdin encrypted under the recovery key RECOV, with a