Expand description
Public key accelerator.
The driver runs on the PKA engine of the CryptoCell (nRF52840, nRF91, nRF5340) or the public key engine of CRACEN (nRF54L). It provides:
- ECDSA signature generation and verification.
- ECDH and public key derivation, through scalar multiplication of a curve point.
- RSA, through modular exponentiation, with or without the Chinese remainder theorem.
Curve points, scalars, moduli and signatures are big-endian byte slices, as in SEC 1 and PKCS#1.
- Every value of a curve operation must be exactly
Curve::sizebytes long. Pad it with zeros on the left if needed. - Every value of an RSA operation must be at most as long as the modulus.
§Example
use embassy_nrf::crypto::pka::{Pka, PointMut, curve};
// On CRACEN (nRF54L) the constructor also takes the engine microcode.
let mut pka = Pka::new_blocking(p.CRYPTO_PKA);
// Derive the public key of a private key.
let mut x = [0; 32];
let mut y = [0; 32];
pka.blocking_public_key(&curve::NIST_P256, &private_key, PointMut { x: &mut x, y: &mut y })?;Modules§
- curve
- Domain parameters of common elliptic curves.
Structs§
- Curve
- Domain parameters of a short Weierstrass curve
y² = x³ + a·x + bover a prime field. - Pka
- Driver for the public key accelerator.
- Point
- A curve point in affine coordinates.
- Point
Mut - Buffers receiving a curve point in affine coordinates.
- Signature
- An ECDSA signature.
- Signature
Mut - Buffers receiving an ECDSA signature.
Enums§
- Error
- PKA error.
Constants§
- MAX_
CURVE_ LEN - Largest curve size in bytes that the driver accepts. This fits NIST P-521.
- MAX_
MODULUS_ LEN - Largest modulus in bytes that the driver accepts. This fits RSA-4096.