summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
6009168)
We'll want it elsewhere soon.
###--------------------------------------------------------------------------
### Recovery operations.
###--------------------------------------------------------------------------
### 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
stash () {
recov=$1 label=$2
## Stash a copy of stdin encrypted under the recovery key RECOV, with a
cat >$tmp/secret
## Read the threshold from the recovery metadata.
cat >$tmp/secret
## Read the threshold from the recovery metadata.
-read param <$KEYS/recov/$recov/$keeper.param
-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%%;*}
+t=$(sharethresh $KEYS/recov/$recov/$keeper.param)
## Find out which keeper index it corresponds to.
read n hunoz <$KEYS/keeper/$keeper/meta
## Find out which keeper index it corresponds to.
read n hunoz <$KEYS/keeper/$keeper/meta