chiark / gitweb /
cryptop.public: New operation to export a key with its properties.
[distorted-keys] / keyfunc.sh.in
index 0256dc0cb48e2820f9a0a6c71fc1e3b9c35028cc..89decccd77af900104ddacea1f1ce96c7c0f12bf 100644 (file)
@@ -240,6 +240,16 @@ EOF
   done
 }
 
+dumpprops () {
+  prefix=$1
+  ## Write the properties stored in the variables beginning with PREFIX.
+
+  set | sed -n "/^$prefix/{s/=.*\$//;p}" | sort | while read name; do
+    eval value=\$$name
+    echo "${name#$prefix}=$value"
+  done
+}
+
 defprops () {
   name=$1
   ## Define a properties table NAME.
@@ -557,6 +567,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