Expand description
Composite multi-algorithm signature aggregation.
Combines classical (Ed25519, ECDSA) and PQ (ML-DSA, SLH-DSA) signatures so that breaking either alone doesn’t break the composite. Used for PQ migration without breaking verifiers.
See TODO.roadmap/35-pq-composite-signatures.md for the full spec.
§Example
use confium_composite::{CompositeSignature, build_ed25519_component, ed25519_verifier, ED25519};
use ed25519_dalek::{Signer, SigningKey};
use ed25519_dalek::rand_core::UnwrapErr;
let signing = SigningKey::generate(&mut UnwrapErr(getrandom::SysRng));
let message = b"hybrid sig demo";
let component = build_ed25519_component(&signing, message)?;
let composite = CompositeSignature::new(vec![component]);
let result = composite.verify(message, |alg, pk, msg, sig| {
if alg == ED25519 { ed25519_verifier(alg, pk, msg, sig) }
else { Err(format!("unknown algorithm: {alg}")) }
})?;
assert!(result.all_verified);Modules§
- algorithm_
ids - Standard composite algorithm IDs per IETF LAMPS COMPOSITE SIG draft.
- cache
- LRU cache for signature verification results.
- cose
- COSE_Sign1 — CBOR-encoded signature wrapper (RFC 8152).
Structs§
- Component
Result - Per-component verification result.
- Component
Signature - A single component of a composite signature.
- Composite
Signature - A composite signature — multiple components over the same message.
- Verification
Result - Aggregate verification result.
Enums§
- Composite
Error - Errors during composite signature operations.
Constants§
- ECDSA_
P256 - Algorithm identifier for ECDSA-P256 components (NIST P-256 + SHA-256).
- ED25519
- Algorithm identifier for Ed25519 components.
- MLDSA65
- Verify an ECDSA-P256 signature (NIST P-256 over SHA-256). The public key is encoded as SEC1 (compressed 33 bytes or uncompressed 65 bytes). The signature is DER-encoded per RFC 5480.
- ML_
DSA_ 65 - Algorithm identifier for ML-DSA-65 components (placeholder; no real verifier).
Functions§
- build_
ed25519_ component - Build a real Ed25519 component signature. Used for testing and as a reference for plugin authors.
- build_
p256_ component - Build a real ECDSA-P256 component signature (NIST P-256 over SHA-256). The signature is DER-encoded per RFC 5480; the public key is SEC1 (uncompressed, 65 bytes).
- ed25519_
verifier - Real Ed25519 verifier. Use as the verifier callback when the composite contains an Ed25519 component. Returns Ok if the Ed25519 component verifies.
- p256_
verifier