Expand description
NIST P-256 (secp256r1, prime256v1).
Three groups of types, each served by its own driver:
ScalarandPoint: arithmetic, viadriver::P256Arith.SecretKey,PublicKeyandSharedSecret: ECDH, viadriver::P256Ecdh.SigningKey,VerifyingKeyandSignature: ECDSA over SHA-256 digests, viadriver::P256Ecdsa.- Compressed SEC1 encodings are decoded via
driver::P256Arith.
§Example
ⓘ
use embassy_crypto::p256::{SecretKey, PublicKey};
let mine = SecretKey::generate()?;
let peer = PublicKey::from_sec1(&peer_bytes)?;
let shared = mine.diffie_hellman(&peer)?;
// feed shared.as_bytes() to a KDFStructs§
- Point
- A point on the curve, the point at infinity included.
- Public
Key - An ECDH public key: a point on the curve.
- Scalar
- A scalar: an integer modulo the curve order
n. - Secret
Key - An ECDH private key: a nonzero scalar.
- Shared
Secret - An ECDH shared secret: the X coordinate of the shared point.
- Signature
- An ECDSA signature
(r, s). - Signing
Key - An ECDSA signing key: a nonzero scalar.
- Verifying
Key - An ECDSA verifying key: a point on the curve.
Constants§
- COMPRESSED_
SEC1_ SIZE - Size of a point in compressed sec1 format.
- FIELD_
SIZE - Size of a field element, key, scalar and coordinate, in bytes.
- ORDER
- The curve order
n, big-endian. - SEC1_
SIZE - Size of a point in sec1 format.