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

    Curve

    pub(all) enum Curve {
    P256
    P384
    P521
    Secp256k1
    } derive(Eq,
    Debug
    )

    Which curve a key lives on.

    The four short-Weierstrass curves that protocols in use actually name: the three NIST primes, which TLS and JOSE speak, and secp256k1, which Bitcoin and Ethereum speak. They differ only in their parameters, so the arithmetic below is written once and each curve is a row in a table.

    Curve::equal

    fn Curve::equal(Curve, Curve) -> Bool

    Curve::not_equal

    fn Curve::not_equal(x : Curve, y : Curve) -> Bool

    Curve::size

    fn Curve::size(self : Curve) -> Int

    The width in bytes of a coordinate, a scalar, and each half of a signature.

    Curve::to_repr

    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

    fn PrivateKey::curve(self : PrivateKey) -> Curve

    Which curve this key is on.

    PrivateKey::new

    fn PrivateKey::new(scalar : BytesView, curve? : Curve) -> PrivateKey raise
    Broken

    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

    fn PrivateKey::with_hash(scalar : BytesView, hash : () -> &
    Hash
    , curve? : Curve) -> PrivateKey raise
    Broken

    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

    fn PublicKey::curve(self : PublicKey) -> Curve

    Which curve this key is on.

    PublicKey::new

    fn PublicKey::new(point : BytesView, curve? : Curve) -> PublicKey raise
    Broken

    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

    fn PublicKey::of_xy(x : BytesView, y : BytesView, curve? : Curve) -> PublicKey raise
    Broken

    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

    fn PublicKey::with_hash(point : BytesView, hash : () -> &
    Hash
    , curve? : Curve) -> PublicKey raise
    Broken

    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