Expand description
§RustCrypto: Elliptic Curve Traits
General purpose Elliptic Curve Cryptography (ECC) support, including types and traits for representing various elliptic curve forms, scalars, points, and public/secret keys composed thereof.
§License
All crates licensed under either of
at your option.
§Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
§Usage
This crate provides traits for describing elliptic curves, along with types which are generic over elliptic curves which can be used as the basis of curve-agnostic code.
It’s intended to be used with the following concrete elliptic curve
implementations from the RustCrypto/elliptic-curves project:
bp256: brainpoolP256r1 and brainpoolP256t1bp384: brainpoolP384r1 and brainpoolP384t1k256: secp256k1 a.k.a. K-256p224: NIST P-224 a.k.a. secp224r1p256: NIST P-256 a.k.a secp256r1, prime256v1p384: NIST P-384 a.k.a. secp384r1p521: NIST P-521 a.k.a. secp521r1
The ecdsa crate provides a generic implementation of the
Elliptic Curve Digital Signature Algorithm which can be used with any of
the above crates, either via an external ECDSA implementation, or
using native curve arithmetic where applicable.
§Type conversions
The following chart illustrates the various conversions possible between the various types defined by this crate.
§serde support
When the serde feature of this crate is enabled, Serialize and
Deserialize impls are provided for the following types:
Please see type-specific documentation for more information.
Re-exports§
pub use crate::field::FieldBytes;pub use crate::field::FieldBytesSize;pub use crate::scalar::ScalarValue;pub use crate::point::AffinePoint;pub use crate::point::BatchNormalize;pub use crate::point::ProjectivePoint;pub use crate::scalar::NonZeroScalar;pub use crate::scalar::Scalar;pub use array;pub use bigint;pub use bigint::ctutils;pub use common;pub use rand_core;pub use subtle;pub use zeroize;pub use pkcs8;pub use ff;pub use group;
Modules§
- arithmetic 🔒
- Elliptic curve arithmetic traits.
- consts
- ecdh
- Elliptic Curve Diffie-Hellman Support.
- error 🔒
- Error type.
- field
- Field element encoding support.
- hazmat
- Hazardous materials (a.k.a. “hazmat”): low-level primitives.
- macros 🔒
- Macros for writing common patterns that interact with this crate.
- ops
- Traits for arithmetic operations on elliptic curve field elements.
- point
- Traits for elliptic curve points.
- public_
key 🔒 - Elliptic curve public keys.
- scalar
- Scalar types.
- sec1
- Support for SEC1 elliptic curve encoding formats.
- secret_
key 🔒 - Secret keys for elliptic curves (i.e. private scalars).
Macros§
- scalar_
from_ impls - Writes a series of
Fromimpls for scalar field types. - scalar_
impls - Writes all impls for scalar field types.
- scalar_
mul_ impls - Writes a series of
Mulimpls for an elliptic curve’s scalar field.
Structs§
Enums§
- Byte
Order - Byte order used when encoding/decoding field elements as bytestrings.
- Decode
Error - Decoding errors for elliptic curve keys.
Constants§
- ALGORITHM_
OID - Algorithm
ObjectIdentifierfor elliptic curve public key cryptography (id-ecPublicKey).
Traits§
- Curve
- Elliptic curve.
- Curve
Affine - Affine representation of an elliptic curve point.
- Curve
Arithmetic - Elliptic curve with an arithmetic implementation.
- Curve
Group - Efficient representation of an elliptic curve point.
- Field
- This trait represents an element of a field.
- Generate
- Secure random generation.
- Group
- This trait represents an element of a cryptographic group.
- Prime
Curve - Marker trait for elliptic curves with prime order.
- Prime
Curve Arithmetic - Prime order elliptic curve with projective arithmetic implementation.
- Prime
Field - This represents an element of a non-binary prime field.
Type Aliases§
- Decode
Result - Result type for
DecodeError. - Result
- Result type with the
elliptic-curvecrate’sErrortype.