Skip to main content

Crate elliptic_curve

Crate elliptic_curve 

Source
Expand description

§RustCrypto: Elliptic Curve Traits

crate Docs Build Status Apache2/MIT licensed Rust Version Project Chat

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 brainpoolP256t1
  • bp384: brainpoolP384r1 and brainpoolP384t1
  • k256: secp256k1 a.k.a. K-256
  • p224: NIST P-224 a.k.a. secp224r1
  • p256: NIST P-256 a.k.a secp256r1, prime256v1
  • p384: NIST P-384 a.k.a. secp384r1
  • p521: 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.

Type Conversion Map

§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;arithmetic
pub use crate::point::BatchNormalize;arithmetic
pub use crate::point::ProjectivePoint;arithmetic
pub use crate::scalar::NonZeroScalar;arithmetic
pub use crate::scalar::Scalar;arithmetic
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;pkcs8
pub use ff;arithmetic
pub use group;arithmetic

Modules§

consts
ecdhecdh
Elliptic Curve Diffie-Hellman Support.
field
Field element encoding support.
hazmatarithmetic
Hazardous materials (a.k.a. “hazmat”): low-level primitives.
opsarithmetic
Traits for arithmetic operations on elliptic curve field elements.
point
Traits for elliptic curve points.
scalar
Scalar types.
sec1sec1
Support for SEC1 elliptic curve encoding formats.

Macros§

scalar_from_impls
Writes a series of From impls for scalar field types.
scalar_impls
Writes all impls for scalar field types.
scalar_mul_impls
Writes a series of Mul impls for an elliptic curve’s scalar field.

Structs§

Error
Elliptic curve errors.
PublicKeyarithmetic
Elliptic curve public keys.
SecretKey
Elliptic curve secret keys.

Enums§

ByteOrder
Byte order used when encoding/decoding field elements as bytestrings.
DecodeErrorpkcs8 or sec1
Decoding errors for elliptic curve keys.

Constants§

ALGORITHM_OIDpkcs8
Algorithm ObjectIdentifier for elliptic curve public key cryptography (id-ecPublicKey).

Traits§

Curve
Elliptic curve.
CurveAffinearithmetic
Affine representation of an elliptic curve point.
CurveArithmeticarithmetic
Elliptic curve with an arithmetic implementation.
CurveGrouparithmetic
Efficient representation of an elliptic curve point.
Fieldarithmetic
This trait represents an element of a field.
Generate
Secure random generation.
Grouparithmetic
This trait represents an element of a cryptographic group.
PrimeCurve
Marker trait for elliptic curves with prime order.
PrimeCurveArithmeticarithmetic
Prime order elliptic curve with projective arithmetic implementation.
PrimeFieldarithmetic
This represents an element of a non-binary prime field.

Type Aliases§

DecodeResultpkcs8 or sec1
Result type for DecodeError.
Result
Result type with the elliptic-curve crate’s Error type.