Skip to main content

Module signing

Module signing 

Source
Available on crate feature signing only.
Expand description

Agent card signing and verification (spec §8.4).

Provides RFC 8785 JSON canonicalization and JWS compact serialization with detached payload for signing AgentCard documents.

This module is only available when the signing feature is enabled.

§Algorithm support

ES256 (ECDSA with P-256 and SHA-256) and EdDSA (Ed25519, RFC 8037), both through ring. Keys are accepted raw, as SubjectPublicKeyInfo DER, or as a JWK from a JWK Set (Jwks), selected by the signature’s kid.

Structs§

Jwk
One key of a JWK Set, as RFC 7517 writes it; only the members needed to select and use a public key are read.
Jwks
A JWK Set: what a jku URL serves.
SignatureHeader
The decoded JWS protected header of an AgentCardSignature.

Enums§

VerifyingKey
A public key and the one algorithm it may verify.

Functions§

canonicalize
Produces an RFC 8785 (JCS) canonical JSON serialization of a value.
canonicalize_card
Canonicalizes an AgentCard to bytes for signing.
canonicalize_card_json
canonicalize_card for a card as received: the JSON object a peer served, with every field it holds, including ones this SDK does not model.
sign_card_ed25519
Signs an AgentCard with Ed25519 (JWS EdDSA, RFC 8037), as sign_card_es256 does for ES256.
sign_card_ed25519_with_jku
sign_card_ed25519, with jku in the protected header, as sign_card_es256_with_jku.
sign_card_es256
Signs an AgentCard with ES256 (ECDSA P-256 + SHA-256), JWS compact serialization with a detached payload (spec §8.4).
sign_card_es256_with_jku
sign_card_es256, with the JWK Set URL a verifier can fetch the key from in the protected header (spec §8.4.2: the protected header MAY include jku).
signature_header
Decodes the JWS protected header of an AgentCardSignature.
verify_agent_card
Verifies an AgentCardSignature against an AgentCard using the given public key.
verify_agent_card_with_jwks
Verifies an AgentCardSignature against the keys of a JWK Set: those with the signature’s kid (every key, when it names none) whose type is for its alg. Succeeds when one of them verifies.
verify_card_json_with_jwks
verify_card_with_jwks for a card as received: the JSON object a peer served, verified before it is read into an AgentCard.
verify_card_with_jwks
Verifies a card against a JWK Set.