Expand description
Pure Rust implementation of the NIST P-256 elliptic curve, including support for the Elliptic Curve Digital Signature Algorithm (ECDSA), Elliptic Curve Diffie-Hellman (ECDH), and general purpose elliptic curve/field arithmetic which can be used to implement protocols based on group operations.
§About NIST P-256
NIST P-256 is a Weierstrass curve specified in FIPS 186-4: Digital Signature Standard (DSS):
https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-4.pdf
Also known as prime256v1 (ANSI X9.62) and secp256r1 (SECG), P-256 is
included in the US National Security Agency’s “Suite B” and is widely used
in Internet and connected device protocols like TLS, the X.509 PKI, and
Bluetooth.
§⚠️ Security Warning
The elliptic curve arithmetic contained in this crate has never been independently audited!
This crate has been designed with the goal of ensuring that secret-dependent
operations are performed in constant time (using the subtle crate and
constant-time formulas). However, it has not been thoroughly assessed to ensure
that generated assembly is constant time on common CPU architectures.
USE AT YOUR OWN RISK!
§Minimum Supported Rust Version
Rust 1.47 or higher.
Minimum supported Rust version may be changed in the future, but it will be accompanied with a minor version bump.
Re-exports§
pub use self;
Modules§
- ecdh
- Elliptic Curve Diffie-Hellman (Ephemeral) Support.
- ecdsa
- Elliptic Curve Digital Signature Algorithm (ECDSA)
Structs§
- Affine
Point - A point on the secp256r1 curve in affine coordinates.
- Blinded
Scalar - Scalar blinded with a randomly generated masking value.
- Nist
P256 - NIST P-256 elliptic curve.
- Projective
Point - A point on the secp256r1 curve in projective coordinates.
- Scalar
- Scalars are elements in the finite field modulo n.
Type Aliases§
- Compressed
Point - Compressed SEC1-encoded NIST P-256 curve point.
- Encoded
Point - NIST P-256 SEC1 encoded point.
- Field
Bytes - NIST P-256 field element serialized as bytes.
- NonZero
Scalar - Non-zero NIST P-256 scalar field element.
- Public
Key - NIST P-256 public key.
- Scalar
Bytes - Scalar bytes: wrapper for
FieldByteswhich guarantees that the the inner byte value is within range of the [Curve::ORDER]. - Secret
Key - NIST P-256 secret key.
- U256
- 256-bit unsigned big integer