# Ed25519 test fixture provenance All key material in `Fixtures.Ed25519` is published or deterministically derived fixture data. It must never be used for application wallets. No user keys, credentials, operational signing material, or network access are involved. The ordinary Haskell tests need no Python packages. ## Pinned native sources and notices Fixture source revision: `8dc0c55f4132fcaa2e7961b6cfbfea96a6d93b5d`. The current build revision is recorded separately in `native/cardano-c.ref`. The four normal-key vectors were transcribed from `lib/tests/crypto/ed25519_vectors.h`, array `cardano_ed25519_test_vectors`. That source identifies them as the RFC 8032 section 7.1 Ed25519 cases TEST 1, TEST 2, TEST 3, and TEST 1024. Their message lengths are respectively 0, 1, 2, and 1023 bytes; TEST 1024 is the RFC's label, not its message length. The fixed extended-key vector was transcribed from `lib/tests/crypto/ed25519_private_key.cpp`, constants `PRIVATE_EXTENDED_PRIVATE_HEX`, `PRIVATE_EXTENDED_PUBLIC_HEX`, `MESSAGE_VECTOR_PRIVATE_EXTENDED_BYTES`, and `SIGNATURE_VECTOR_PRIVATE_EXTENDED`. Its message contains 64 bytes. Both native fixture sources are Copyright 2024 Biglup Labs, licensed under Apache-2.0. This repository includes that license in `LICENSE`. The fixture module retains the project notice, and this provenance preserves attribution for the imported values. No native test generator or implementation was copied. Original RFC source: [RFC 8032, section 7.1](https://www.rfc-editor.org/rfc/rfc8032.html#section-7.1), Simon Josefsson and Ilari Liusvaara, January 2017. Its notice is Copyright (c) 2017 IETF Trust and the persons identified as the document authors, with terms at [IETF Trust legal provisions](https://trustee.ietf.org/license-info/). The RFC's published numerical test values are carried here through the pinned native fixture source. ## Independent checks Python `cryptography` 48.0.0 (OpenSSL Ed25519) independently regenerated the public keys and exact signatures of all four normal-key vectors. It also verified the fixed extended-key signature against its public key and message. These checks were performed when importing the fixtures; Haskell CI uses the literal expected values and does not install Python cryptography dependencies. Every fixture public-key hash was computed independently using `hashlib.blake2b(public_key_bytes, digest_size=28)`: | Fixture | BLAKE2b-224 public-key hash | | --- | --- | | RFC TEST 1 | `35dedd2982a03cf39e7dce03c839994ffdec2ec6b04f1cf2d40e61a3` | | RFC TEST 2 | `977efb35ab621d39dbeb7274ec7795a34708ff4d25a01a1df04c1f27` | | RFC TEST 3 | `7f8a76c0ebaa4ad20dfdcd51a5de070ab771f4bf377f2c41e6b71c0a` | | RFC TEST 1024 | `3fa478a09cf841058b3e63abe2cfc50aac0ea46d84eaa50a6ae5accc` | | Extended | `ebf46bc374bda5b937d4d964fc0b73e940a9ea7d8cfdf39162a6f207` | ## Additional empty and embedded-NUL cases A normal-key embedded-NUL case uses RFC TEST 1's published seed and message bytes `00 01 00 ff`. Its expected signature was generated using `cryptography`'s `Ed25519PrivateKey.sign`. The extended-key empty-message and embedded-NUL cases use the pinned extended key and messages `[]` and `[0, 1, 0, 255]`. Expected signatures were independently constructed with the standard expanded-secret Ed25519 equations, using PyNaCl's scalar arithmetic and base-point operations plus Python `hashlib.sha512`: ```text secret = scalar || prefix A = scalar * B r = SHA512(prefix || message) mod L R = r * B k = SHA512(R || A || message) mod L S = (r + k * scalar) mod L signature = R || S ``` PyNaCl 1.5.0 supplied `crypto_core_ed25519_scalar_reduce`, scalar multiplication and addition, and `crypto_scalarmult_ed25519_base_noclamp`. OpenSSL Ed25519 via `cryptography` then independently verified the resulting signatures. These are expanded-key Ed25519 fixtures, not Ed25519ph, Ed25519ctx, or BIP32 derivation vectors. The copied key type is 64-byte scalar-and-prefix material, rather than a 32-byte normal seed. ## Lifecycle and property evidence A separate 64-byte all-zero expanded-key input deliberately passes length validation but fails native scalar multiplication. Native source `ed25519_private_key.c` checks the base-point operation in `compute_extended_public_key` and `compute_signature_with_extended_key`, returning a generic error for this unusable scalar. Tests assert exact sanitized operation errors, closure of the escaped public handle, and native reference disposal after that operation failure. This is not treated as an import-length error. The Haskell properties are new project code: 300 public-key byte/hex round trips, 300 signature byte/hex round trips, 300 normal seed/message sign-and-verify cases, and 300 extended-key message cases. Generated normal seeds are redacted in property diagnostics. The fixture record deliberately has no `Show` instance. Lifecycle tests exercise scoped success, callback `Left`, thrown exceptions, asynchronous cancellation, explicit repeated close, escaped handles, explicit exports, independent clone allocation, public snapshots after close and GC, and signing concurrent with close. Test-only native ref/refcount/unref imports retain an independent reference while checking that scope exit releases exactly one reference (2 to 1) after success, callback failure, exception, or cancellation. The retained test reference is released by a surrounding bracket on every exit. A trusted private operation pauses under the same key lock used for signing, then signs with the real native function while a concurrent close waits for that lock. No allocation counters or pointer hooks are added to the public API. These tests establish disposal and lifetime behavior, not comprehensive erasure of every stack or runtime copy. Explicit key export produces ordinary Haskell bytes/text with a lifetime outside the scoped key handle.