Skip to main content

X25519Recipient

Struct X25519Recipient 

Source
pub struct X25519Recipient { /* private fields */ }
Expand description

A local X25519 recipient: the materialized static private key (Zeroizing) plus its key id.

Implementations§

Source§

impl X25519Recipient

Source

pub const fn new(key_id: KeyId, private: Zeroizing<[u8; 32]>) -> Self

Build a recipient from the 32 private key bytes.

Source

pub fn from_private_slice( key_id: KeyId, bytes: &[u8], ) -> Result<Self, KeyLengthError>

Wrap a raw private key slice, failing closed (never indexing) on a wrong length. The caller should hand the slice from a Zeroizing buffer; the copy taken here is itself Zeroizing.

§Errors

KeyLengthError if bytes is not exactly 32 bytes.

Source

pub fn public(&self) -> X25519RecipientPublic

The corresponding public half (derived; the private never leaves).

Trait Implementations§

Source§

impl Recipient for X25519Recipient

Source§

fn key_id(&self) -> &KeyId

The recipient (static X25519) key id.
Source§

async fn open( &self, request: &OpenRequest<'_>, ) -> Result<Zeroizing<Vec<u8>>, OpenError>

Open the message, returning the plaintext in a zeroizing buffer.

Auto Trait Implementations§

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> 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<T> Same for T

Source§

type Output = T

Should always be Self
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.