docs

v0.1.2 문서를 보고 있습니다. 이 버전은 더 이상 지원하지 않습니다. 최신 릴리스: v0.1.3 →

core::crypto::ecdsa

이 페이지의 내용

API 참조는 영어로만 있습니다. 표준 라이브러리 소스의 영어 문서 주석에서 만듭니다.

ECDSA (FIPS 186-5) on P-256 and P-384: verification, and signing with RFC 6979 deterministic nonces. Field elements are fixed arrays of 32-bit limbs ([u32; 12], P-256 uses the low 8) in Montgomery form, so arithmetic allocates nothing. Points are projective (X : Y : Z) with the complete formulas of Renes, Costello and Batina (2016, algorithms 4 and 6, a = -3), which handle doubling and the identity (0 : 1 : 0) without special cases.

Signing runs in constant time: the scalar multiplication reads its table with a masked scan, inversions are Fermat powers with a public exponent, carries and reductions are masks. Verification sees public data only and indexes its tables by scalar digits.

Structs

SigningKeySource

pub struct SigningKey

A signing key: the secret scalar (big-endian, the curve's size) in secret storage, and its public point. It has one owner (let b = a moves it); wipe and its release clear it.

  • pub fn from_bytes<B: AsBytes>(curve: EcCurve, bytes: B) throws (ValueError) -> SigningKey§

    Source

    The key of a big-endian scalar of at most the curve's size, 1 <= d < q.

  • pub const fn curve(self) -> EcCurve§

    Source

    The key's curve.

  • pub const fn verifying_key(self) -> VerifyingKey§

    Source

    The public key that checks this key's signatures.

  • pub fn wipe(self)§

    Source

    Overwrite the scalar with zeros now (every copy shares it); sign is meaningless afterwards.

  • pub fn sign<M: AsBytes>(self, hash: HashAlgorithm, msg: M) -> List<u8>§

    Source

    A DER signature of msg, hashed with hash; the nonce is derived per RFC 6979 (HMAC-DRBG with hash).

Trait implementations 3
  • impl !Sync for SigningKey
  • impl Debug for SigningKey
  • impl Drop for SigningKey

VerifyingKeySource

pub struct VerifyingKey

A public key: a point on curve, SEC1 uncompressed.

Enums

EcCurveSource

pub enum EcCurve

The elliptic curves Ecdsa signs over: NIST P-256 and P-384.