You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DateKeys/scripts/recovery_check.sh

32 lines
957 B

#!/usr/bin/env bash
# Opens official fixture capsules with scripts/recovery, a program that uses
# no DateKeys code (only Go, age, kyber and x/crypto), and compares what it
# recovers with the plaintext fixtures. It shows that the annex
# "Recuperación sin software DateKeys" of the specification is enough.
#
# scripts/recovery_check.sh
set -euo pipefail
cd "$(dirname "$0")/.."
tmp=$(mktemp -d)
trap 'rm -rf "$tmp"' EXIT
fx=testdata/fixtures
rel=testdata/releases
recover_one() {
local name=$1 round=$2
shift 2
echo "== $name (round $round)"
go run ./scripts/recovery -dkc "$fx/$name.dkc" -release "$rel/$round.dkr" "$@" \
-out "$tmp/$name" -body "$tmp/$name.body"
cmp "$tmp/$name.body" "$fx/$name.plaintext"
echo "files written:"
(cd "$tmp/$name" && find . -type f | sort)
}
recover_one format3_single 1000
recover_one format3_time_and_key_portable 1000 -dkk "$fx/format3_time_and_key_portable.dkk"
echo "recovery check passed"

Powered by TurnKey Linux.