Skip to content

common_auth.contracts.signatures

Signature values, key identification and protected signed assertions.

These values describe supplied material. They never load keys, calculate fingerprints, sign messages or establish cryptographic trust. Wire profiles translate their own algorithm names and signature encodings at the boundary.

Classes

KeyBinding

Bases: BaseModel

A supplied SHA-256 key/certificate confirmation fingerprint.

JWK fingerprints hash the canonical public JWK; certificate fingerprints hash the DER certificate. This value validates the canonical digest shape, not the source material or possession of its private key. A local KeyId cannot substitute for this fingerprint.

Fields and properties declared here; inherited members belong to the bases above.

kind

kind: Literal['jwk_sha256', 'certificate_sha256']

thumbprint

thumbprint: _IdentityText

Signature

Bases: _SignedValue

Protected signature bytes in an explicit representation.

Raw ECDSA means fixed-width R followed by S; DER is available only for ECDSA. Bytes or an explicit {‘base64’: ’…’} configuration object supply the value. Encoding compatibility is checked here; signature structure, length, key compatibility and mathematical verification belong to the signer/verifier.

Fields and properties declared here; inherited members belong to the bases above.

algorithm

algorithm: SignatureAlgorithm = Field(strict=False)

encoding

encoding: Literal['raw', 'der'] = 'raw'

key_id

key_id: KeyId | None = None

value

value: SecretBytes = Field(min_length=1, repr=False, exclude=True)

SignatureAlgorithm

Bases: StrEnum

Fully specified cryptographic choices, independent of protocol spellings.

ECDSA uses the P-256 curve and SHA-256; RSA uses PKCS#1 v1.5 padding with SHA-256. Ed25519 is the pure Ed25519 algorithm. These tags do not select a trust policy or assert that a supplied key is compatible.

Fields and properties declared here; inherited members belong to the bases above.

ECDSA_P256_SHA256

ECDSA_P256_SHA256 = 'ecdsa_p256_sha256'

ED25519

ED25519 = 'ed25519'

HMAC_SHA256

HMAC_SHA256 = 'hmac_sha256'

RSA_PKCS1V15_SHA256

RSA_PKCS1V15_SHA256 = 'rsa_pkcs1v15_sha256'

SignedAssertion

Bases: _SignedValue

A complete signed compact JWT, protected as replayable auth material.

Construction checks three canonical base64url segments, JSON object header and claims without duplicate members/nonstandard constants, and a declared non-‘none’ algorithm. It neither verifies the signature nor trusts any claim/header. Algorithm policy, critical headers, issuer/audience, lifetime and replay protection remain verifier duties. Ordinary dumps exclude the value and cannot serve as secret backups.

Fields and properties declared here; inherited members belong to the bases above.

format

format: Literal['jwt'] = 'jwt'

value

value: SecretStr = Field(min_length=1, repr=False, exclude=True)