X25519

Struct X25519 

Source
pub struct X25519;

Trait Implementations§

Source§

impl EcdhArrayref<RAND_LEN, SECRET_LEN, PUBLIC_LEN> for X25519

Source§

fn generate_secret( secret: &mut [U8; 32], rand: &[U8; 32], ) -> Result<(), GenerateSecretError>

Generate a Diffie-Hellman secret value. It is the responsibility of the caller to ensure that the rand argument is actually random.
Source§

fn secret_to_public( public: &mut [u8; 32], secret: &[U8; 32], ) -> Result<(), SecretToPublicError>

Derive a Diffie-Hellman public value from a secret value.
Source§

fn derive_ecdh( derived: &mut [U8; 32], public: &[u8; 32], secret: &[U8; 32], ) -> Result<(), DeriveError>

Derive a Diffie-Hellman shared secret from a public and a secret value. Read more
Source§

fn validate_secret(secret: &[U8; 32]) -> Result<(), ValidateSecretError>

Check the validity of a Diffie-Hellman secret value.
Source§

fn generate_pair( public: &mut [u8; PUBLIC_LEN], secret: &mut [u8; SECRET_LEN], rand: &[u8; RAND_LEN], ) -> Result<(), GenerateSecretError>

Generate a Diffie-Hellman secret value and derive the corresponding public value in one step.
Source§

impl EcdhSlice for X25519

Source§

fn generate_secret( secret: &mut [U8], rand: &[U8], ) -> Result<(), GenerateSecretError>

Generate a Diffie-Hellman secret value. It is the responsibility of the caller to ensure that the rand argument is actually random.
Source§

fn secret_to_public( public: &mut [u8], secret: &[U8], ) -> Result<(), SecretToPublicError>

Derive a Diffie-Hellman public value from a secret value.
Source§

fn derive_ecdh( derived: &mut [U8], public: &[u8], secret: &[U8], ) -> Result<(), DeriveError>

Derive a Diffie-Hellman shared secret from a public and a secret value. Read more
Source§

fn validate_secret(secret: &[U8]) -> Result<(), ValidateSecretError>

Check the validity of a Diffie-Hellman secret value.
Source§

fn generate_pair( public: &mut [u8], secret: &mut [u8], rand: &[u8], ) -> Result<(), GenerateSecretError>

Generate a Diffie-Hellman secret value and derive the corresponding public value in one step.
Source§

impl Kem<DK_LEN, EK_LEN, EK_LEN, SS_LEN, DK_LEN, DK_LEN> for X25519

Source§

fn keygen( ek: &mut [u8; 32], dk: &mut [U8; 32], rand: &[U8; 32], ) -> Result<(), KeyGenError>

Generate a pair of encapsulation and decapsulation keys. It is the responsibility of the caller to ensure that the rand argument is actually random.
Source§

fn encaps( ct: &mut [u8; 32], ss: &mut [U8; 32], ek: &[u8; 32], rand: &[U8; 32], ) -> Result<(), EncapsError>

Encapsulate a shared secret towards a given encapsulation key. It is the responsibility of the caller to ensure that the rand argument is actually random.
Source§

fn decaps( ss: &mut [U8; 32], ct: &[u8; 32], dk: &[U8; 32], ) -> Result<(), DecapsError>

Decapsulate a shared secret.
Source§

impl Kem for X25519

Source§

fn keygen(ek: &mut [u8], dk: &mut [U8], rand: &[U8]) -> Result<(), KeyGenError>

Generate a pair of encapsulation and decapsulation keys. It is the responsibility of the caller to ensure that the rand argument is actually random.
Source§

fn encaps( ct: &mut [u8], ss: &mut [U8], ek: &[u8], rand: &[U8], ) -> Result<(), EncapsError>

Encapsulate a shared secret towards a given encapsulation key. It is the responsibility of the caller to ensure that the rand argument is actually random.
Source§

fn decaps(ss: &mut [U8], ct: &[u8], dk: &[U8]) -> Result<(), DecapsError>

Decapsulate a shared secret.

Auto Trait Implementations§

§

impl Freeze for X25519

§

impl RefUnwindSafe for X25519

§

impl Send for X25519

§

impl Sync for X25519

§

impl Unpin for X25519

§

impl UnwindSafe for X25519

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Classify for T

Source§

type Classified = T

Source§

fn classify(self) -> T

Source§

impl<T> Declassify for T

Source§

impl<const RAND_LEN: usize, const SECRET_LEN: usize, const PUBLIC_LEN: usize, T> EcdhOwned<RAND_LEN, SECRET_LEN, PUBLIC_LEN> for T
where T: EcdhArrayref<RAND_LEN, SECRET_LEN, PUBLIC_LEN>,

Source§

fn generate_secret( rand: &[u8; RAND_LEN], ) -> Result<[u8; SECRET_LEN], GenerateSecretError>

Generate a Diffie-Hellman secret value. It is the responsibility of the caller to ensure that the rand argument is actually random.
Source§

fn secret_to_public( secret: &[u8; SECRET_LEN], ) -> Result<[u8; PUBLIC_LEN], SecretToPublicError>

Derive a Diffie-Hellman public value from a secret value.
Source§

fn derive_ecdh( public: &[u8; PUBLIC_LEN], secret: &[u8; SECRET_LEN], ) -> Result<[u8; PUBLIC_LEN], DeriveError>

Derive a Diffie-Hellman shared secret from a public and a secret value. Read more
Source§

fn validate_secret(secret: &[u8; SECRET_LEN]) -> Result<(), ValidateSecretError>

Check the validity of a Diffie-Hellman secret value.
Source§

fn generate_pair( rand: &[u8; RAND_LEN], ) -> Result<([u8; PUBLIC_LEN], [u8; SECRET_LEN]), GenerateSecretError>

Generate a Diffie-Hellman secret value and derive the corresponding public value in one step.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<const EK_LEN: usize, const DK_LEN: usize, const CT_LEN: usize, const SS_LEN: usize, const RAND_KEYGEN_LEN: usize, const RAND_ENCAPS_LEN: usize, T> Kem<EK_LEN, DK_LEN, CT_LEN, SS_LEN, RAND_KEYGEN_LEN, RAND_ENCAPS_LEN> for T
where T: Kem<EK_LEN, DK_LEN, CT_LEN, SS_LEN, RAND_KEYGEN_LEN, RAND_ENCAPS_LEN>,

Source§

fn keygen( rand: &[u8; RAND_KEYGEN_LEN], ) -> Result<([u8; DK_LEN], [u8; EK_LEN]), KeyGenError>

Generate a pair of encapsulation and decapsulation keys. It is the responsibility of the caller to ensure that the rand argument is actually random.
Source§

fn encaps( ek: &[u8; EK_LEN], rand: &[u8; RAND_ENCAPS_LEN], ) -> Result<([u8; SS_LEN], [u8; CT_LEN]), EncapsError>

Encapsulate a shared secret towards a given encapsulation key. It is the responsibility of the caller to ensure that the rand argument is actually random.
Source§

fn decaps( ct: &[u8; CT_LEN], dk: &[u8; DK_LEN], ) -> Result<[u8; SS_LEN], DecapsError>

Decapsulate a shared secret.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.