#!/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.cbor" "$@" \ -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" # The key of words of the annex (79.7): the text of its second vector, # "Ñandú", two spaces, "PINGÜINO", a tab and "camión árbol Éter ola", which # normalizes without tables. printf '\xc3\x91and\xc3\xba PING\xc3\x9cINO\tcami\xc3\xb3n \xc3\xa1rbol \xc3\x89ter ola' >"$tmp/words.txt" recover_one format3_time_and_key_words 1000 -words "$tmp/words.txt" # PAYLOAD_AGE of 65536 bytes of plaintext: one full STREAM chunk, the last # one (79.5). recover_one format3_full_chunk 1000 echo "recovery check passed"