Sign in

    moonbitstack/mooncrypt/sign/ecdsa does not have a README file

    Curve

    Which curve a key lives on: the three NIST primes TLS and JOSE speak, and secp256k1, which Bitcoin and Ethereum speak.

    PrivateKey

    type PrivateKey

    An ECDSA signing key: a scalar less than the group order.

    PrivateKey::bytes

    fn PrivateKey::bytes(self : PrivateKey) -> Bytes

    The scalar this key is written as, big-endian and fixed-width.

    PrivateKey::curve

    Which curve this key is on.

    PrivateKey::new

    Read a signing key from its scalar, big-endian and fixed-width.

    PrivateKey::public

    fn PrivateKey::public(self : PrivateKey) -> PublicKey

    The verification key that matches this signing key: Q = [d]G.

    PrivateKey::sign

    fn PrivateKey::sign(self : PrivateKey, msg : BytesView) -> Bytes

    PrivateKey::with_hash

    A signing key read against a digest of the caller's choosing.

    PublicKey

    type PublicKey

    An ECDSA verification key: a point on the curve.

    PublicKey::bytes

    fn PublicKey::bytes(self : PublicKey) -> Bytes

    The key as an uncompressed SEC 1 point, 04 ∥ X ∥ Y.

    PublicKey::curve

    Which curve this key is on.

    PublicKey::new

    Read a public key from a SEC 1 §2.3.3 encoded point.

    Both forms are accepted: 04 ∥ X ∥ Y uncompressed, and 02/03 ∥ X compressed, where the prefix gives the parity of Y and the rest is recovered from the curve equation.

    The digest is the one the curve is standardly paired with — SHA-256 for the 256-bit curves, SHA-384 for P-384, SHA-512 for P-521 — which is what ES256, ES384 and ES512 mean. Use [PublicKey::with_hash] for any other pairing.

    PublicKey::of_xy

    Read a public key from its two affine coordinates — the shape a JWK carries.

    PublicKey::verify

    fn PublicKey::verify(self : PublicKey, msg : BytesView, sig : BytesView) -> Bool

    PublicKey::with_hash

    A public key read against a digest of the caller's choosing.

    PublicKey::xy

    fn PublicKey::xy(self : PublicKey) -> (Bytes, Bytes)

    The two affine coordinates, each fixed-width — the shape a JWK wants.

    Source Files