#!/usr/bin/env sh
# Verify the E82 detached Ed25519 signature with OpenSSL, not the Python verifier.
set -eu
MANIFEST="MANIFEST.json"
SIG="MANIFEST.sig"
PUB=$(python3 - <<'PY'
import base64, json
m=json.load(open("MANIFEST.json"))
print(base64.b64encode(bytes.fromhex("302a300506032b6570032100")+base64.b64decode(m["signer_public_key_b64"])).decode())
PY
)
printf '%s' "$PUB" | base64 -d > /tmp/e82_pub.der
openssl pkey -pubin -inform DER -in /tmp/e82_pub.der -out /tmp/e82_pub.pem
base64 -d "$SIG" > /tmp/e82_manifest.sig
openssl pkeyutl -verify -pubin -inkey /tmp/e82_pub.pem -rawin -in "$MANIFEST" -sigfile /tmp/e82_manifest.sig
