Expand description
Signing and verification primitives for Chio artifacts.
§Purpose and FIPS Posture
Chio artifacts (capability tokens, receipts, DPoP proofs, governed approval
tokens) are signed with a cryptographic algorithm negotiated between the
kernel operator and its counterparties. The default algorithm is Ed25519
via ed25519-dalek, which matches the historical behaviour of every Chio
deployment and every on-wire artifact produced to date. To unblock
enterprise procurement in FIPS-constrained environments, this module also
exposes a SigningBackend abstraction with pluggable implementations for
NIST P-256 (secp256r1) and P-384 (secp384r1) ECDSA signatures.
The FIPS backends are gated behind the fips Cargo feature and link to
aws-lc-rs, a FIPS 140-3 validated module. When the feature is disabled
the only available backend is pure Ed25519, and the crate has no extra
transitive dependencies. When enabled, callers may construct a
[P256Backend] or [P384Backend] and pass it to any Chio signing helper
that accepts &dyn SigningBackend.
§Backward Compatibility
Ed25519 artifacts serialize byte-for-byte identically to the historical
format: a 64-character lowercase hex string for the public key and a
128-character hex string for the signature. FIPS-algorithm artifacts use a
self-describing hex prefix (e.g. p256: or p384:) so older verifiers
that only understand bare hex recognise that the material is non-Ed25519
and can reject with a clear error rather than misinterpreting bytes.
§Safety Notes
- Private key material held by
Keypairis zeroed on drop viaed25519-dalek’sZeroizeOnDropimplementation. - FIPS-backend private keys are held by
aws-lc-rsowned types which zero their own key material. - No
unsafecode is introduced by this module.
Structs§
- Ed25519
Backend - Ed25519
SigningBackendwrapping the historicalKeypair. - Keypair
- Ed25519 keypair for signing.
- Public
Key - Public key for verifying Chio signatures.
- Signature
- Signature produced by an Chio
SigningBackend.
Enums§
- Signing
Algorithm - Enumerates the signature algorithms Chio knows how to produce and verify.
Traits§
- Signing
Backend - Abstraction over Chio signing algorithms.
Functions§
- canonical_
json_ bytes - Serialize a value to canonical JSON bytes (RFC 8785 / JCS).
- canonical_
json_ string - Serialize a value to a canonical JSON string (RFC 8785 / JCS).
- is_
default_ algorithm - Returns
truewhenalgequals the default algorithm. Free function so it can be referenced from#[serde(skip_serializing_if = "...")]. - is_
default_ optional_ algorithm - Returns
truewhen the optional algorithm is either absent or equal to the default (Ed25519). Used by#[serde(skip_serializing_if)]on envelope fields so that legacy Ed25519 artifacts remain byte-identical on the wire. - sha256_
hex - Compute SHA-256 of the given bytes, returning the hash as lowercase hex.
- sign_
canonical_ with_ backend - Sign the canonical JSON form of
valuewith the given backend.