import type { SlhDsaParams } from './params.js'; import { type PreHashAlgorithm } from './prehash.js'; /** * FIPS 205 §10.2.1 Algorithm 22 line 1 / §10.2.2 Algorithm 23 line 1, * ctx must be ≤ 255 bytes (the byte that follows the domain separator in * M' encodes |ctx|, so longer values cannot be represented). Throws * `SigningError('sig-ctx-too-long')` per the SigningError discriminator contract. */ export declare function validateContext(ctx: Uint8Array): void; /** * FIPS 205 §3.6.2, public key must be exactly pkBytes long for its * parameter set. Throws here; the public verify*() surfaces catch the * throw and return false so a wrong-length pk reads as "not a valid * signature" rather than a caller error. */ export declare function validatePublicKey(pk: Uint8Array, params: SlhDsaParams): void; /** * Signing key must be exactly skBytes long for its parameter set. Wrong * length is a caller error (the caller produced this sk via keygen* or * loaded it from storage they own); throw RangeError unconditionally. */ export declare function validateSigningKey(sk: Uint8Array, params: SlhDsaParams): void; /** * FIPS 205 §3.6.2, signature must be exactly sigBytes long for its * parameter set. Throws here; the public verify*() surfaces catch and * return false (same protocol shape as wrong-length pk). */ export declare function validateSignature(sig: Uint8Array, params: SlhDsaParams): void; /** * FIPS 205 §3.4 / §9.2 Algorithm 19 line 4, opt_rand (addrnd) must be * exactly n bytes for the parameter set. Used by signDerand (the * testing / CAVP API). Hedged sign supplies opt_rand internally; * deterministic sign substitutes PK.seed; only signDerand exposes * opt_rand to the caller. */ export declare function validateRnd(rnd: Uint8Array, params: SlhDsaParams): void; /** * Confirms M is a Uint8Array. FIPS 205 places no length restriction on * the message; M is absorbed into Hmsg via SHAKE256 / SHA-2 depending on * the chosen instantiation (§11.2 SHAKE family in the shipped scope), so * any byte length is admissible. */ export declare function validateMessage(M: Uint8Array): void; /** * FIPS 205 §10.2.2 Algorithm 23 lines 9-20, the prehash PH_M passed to * HashSLH-DSA's Sign_internal / Verify_internal must be exactly the * digest size of `algo`. Used by the `*Prehashed` family where the * caller computes PH externally; the non-prehashed family produces PH * internally so this check is implicit. * * Throws `SigningError('sig-malformed-input')` on mismatch. The verify * surface intercepts this to return false (a wrong-size digest is a * structural mismatch, indistinguishable from a wrong signature), while * the sign surface lets the throw propagate (the caller supplied bad * input; that is a contract violation). * * Duplicated from `src/ts/mldsa/validate.ts:validateDigest`; extraction is * deferred until a third consumer materialises. */ export declare function validateDigest(digest: Uint8Array, algo: PreHashAlgorithm): void;