pub struct X25519Impl;Expand description
The global X25519 implementation.
Implementations§
Source§impl X25519Impl
impl X25519Impl
Sourcepub fn generate_keypair(
rng: &mut dyn Rng,
) -> Result<(X25519PrivateKey, X25519PublicKey), CryptoError>
pub fn generate_keypair( rng: &mut dyn Rng, ) -> Result<(X25519PrivateKey, X25519PublicKey), CryptoError>
Generate a fresh keypair: scalar k, Q = X25519(k, 9).
Used for TLS 1.3 ECDHE keygen.
Sourcepub fn public_key(k: X25519PrivateKey) -> Result<X25519PublicKey, CryptoError>
pub fn public_key(k: X25519PrivateKey) -> Result<X25519PublicKey, CryptoError>
Derive the public key from a known private scalar.
No RNG: used for persistent keys (e.g. a TLS static ECDH identity
loaded from flash) where the caller already holds k.
X25519 shared secret: X25519(k, peer), 32 bytes.
This is the TLS 1.3 ecdhe_shared_secret (fed into HKDF via
HmacSha256).
Trait Implementations§
Source§impl X25519 for X25519Impl
impl X25519 for X25519Impl
Source§fn generate_keypair(
rng: &mut dyn Rng,
) -> Result<(X25519PrivateKey, X25519PublicKey), CryptoError>
fn generate_keypair( rng: &mut dyn Rng, ) -> Result<(X25519PrivateKey, X25519PublicKey), CryptoError>
Source§fn public_key(k: X25519PrivateKey) -> Result<X25519PublicKey, CryptoError>
fn public_key(k: X25519PrivateKey) -> Result<X25519PublicKey, CryptoError>
Derive the public key from a known private scalar. Read more
X25519 shared secret:
X25519(k, peer), 32 bytes. Read moreAuto Trait Implementations§
impl Freeze for X25519Impl
impl RefUnwindSafe for X25519Impl
impl Send for X25519Impl
impl Sync for X25519Impl
impl Unpin for X25519Impl
impl UnsafeUnpin for X25519Impl
impl UnwindSafe for X25519Impl
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more