Skip to main content

Module ecdsa_sign

Module ecdsa_sign 

Source
Expand description

ECDSA signing-key minting (FIPS 186-5).

Security:

  • ECDSA signing handles a per-signature secret nonce whose timing leakage is key-recovering. Providers in attacker-observable timing domains do not export this interface, and compositions requiring it then fail at composition time (see README.md, “Timing-channel policy”). Host-backed providers serve it.

Signing keys import as PKCS#8 or an EC private JWK — the platform pass-through formats — and never as bare scalars (no platform door; see README.md, “Design notes”, the format-admission rule). Imports return only the signing key: the public half is never derived from a private import (the w3c/webcrypto#356 gap), so importers needing it supply it separately via ecdsa-verify.

Note the signature is not deterministic across implementations: RFC 6979 (deterministic) and randomized-k implementations both verify, but produce different bytes for the same input.

Functions§

generate_key
Generate a fresh random signing key of the declared variant, returning both halves — the only point at which every provider is guaranteed to have the public key on hand.
import_signing_key_jwk
Import a signing key as an EC private JWK (kty: "EC", with crv, d, and the mandatory public coordinates x/y, which implementations MAY validate against d and MUST NOT trust). crv and alg are validated as in import-verifying-key-jwk. See mac-key.export-key-jwk for the package-wide JWK contract.
import_signing_key_pkcs8
Import a signing key as a PKCS#8 PrivateKeyInfo (DER, the SEC1 private-key body). The encoded curve must match the declared variant’s (error.invalid-key); an embedded public key, when present, is validated against the scalar and never trusted on its own. Returns only the signing key (see the interface doc).
unwrap_signing_key_jwk
Mint a signing key from unwrapped key material read as an EC private JWK, subject to import-signing-key-jwk’s contract plus the unwrap-path use/key_ops checks (see README.md, “JWK contract”). input is consumed; see unwrap-signing-key-pkcs8 for the options model.
unwrap_signing_key_pkcs8
Mint a signing key from unwrapped key material (see the wrapping interface): input’s bytes are read as a PKCS#8 PrivateKeyInfo, subject to import-signing-key-pkcs8’s contract. input is consumed.

Type Aliases§

EcdsaVariant
Error
SigningKey
SigningKeyOptions
UnwrapInput
VerifyingKey