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.
§Minimum Supported Rust Version
Requires Rust 1.57 or higher.
Minimum supported Rust version can be changed in the future, but it will be done with a minor version bump.
§SemVer Policy
- All on-by-default features of this library are covered by SemVer
- MSRV is considered exempt from SemVer as noted above
§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-256p256
: NIST P-256 a.k.a secp256r1, prime256v1p384
: NIST P-384 a.k.a. secp384r1
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:
- [
JwkEcKey
] PublicKey
ScalarCore
Please see type-specific documentation for more information.
Re-exports§
pub use crypto_bigint as bigint;
pub use generic_array;
pub use rand_core;
pub use subtle;
pub use zeroize;
pub use ff;
pub use group;
pub use pkcs8;
Modules§
- consts
- ecdh
- Elliptic Curve Diffie-Hellman Support.
- ops
- Traits for arithmetic operations on elliptic curve field elements.
- sec1
- Support for SEC1 elliptic curve encoding formats.
- weierstrass
- Complete projective formulas for prime order elliptic curves as described in Renes-Costello-Batina 2015.
Macros§
- impl_
field_ element - Provides both inherent and trait impls for a field element type which are backed by a core set of arithmetic functions specified as macro arguments.
- impl_
field_ op - Emit impls for a
core::ops
trait for all combinations of reference types, which thunk to the given function.
Structs§
- Error
- Elliptic curve errors.
- NonZero
Scalar - Non-zero scalar type.
- Public
Key - Elliptic curve public keys.
- Scalar
Core - Generic scalar type with core functionality.
- Secret
Key - Elliptic curve secret keys.
Constants§
- ALGORITHM_
OID - Algorithm
ObjectIdentifier
for elliptic curve public key cryptography (id-ecPublicKey
).
Traits§
- Affine
Arithmetic - Elliptic curve with affine arithmetic implementation.
- AffineX
Coordinate - Obtain the affine x-coordinate of an elliptic curve point.
- Curve
- Elliptic curve.
- Decompact
Point - Decompact an elliptic curve point from an x-coordinate.
- Decompress
Point - Decompress an elliptic curve point.
- Field
- This trait represents an element of a field.
- Group
- This trait represents an element of a cryptographic group.
- IsHigh
- Is this scalar greater than n / 2?
- Point
Compaction - Point compaction settings.
- Point
Compression - Point compression settings.
- 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 prime field.
- Projective
Arithmetic - Elliptic curve with projective arithmetic implementation.
- Scalar
Arithmetic - Scalar arithmetic.
Type Aliases§
- Affine
Point - Affine point type for a given curve with a
ProjectiveArithmetic
implementation. - Field
Bytes - Byte representation of a base/scalar field element of a given curve.
- Field
Size - Size of field elements of this elliptic curve.
- Projective
Point - Projective point type for a given curve with a
ProjectiveArithmetic
implementation. - Result
- Result type with the
elliptic-curve
crate’sError
type. - Scalar
- Scalar field element for a particular elliptic curve.