Struct hpke_rs::HpkeKeyPair

source ·
pub struct HpkeKeyPair { /* private fields */ }
Expand description

An HPKE key pair has an HPKE private and public key.

Implementations§

source§

impl HpkeKeyPair

source

pub fn new(sk: Vec<u8>, pk: Vec<u8>) -> Self

Create a new HPKE key pair. Consumes the private and public key bytes.

source

pub fn private_key(&self) -> &HpkePrivateKey

Get a reference to the HPKE private key of this key pair.

source

pub fn public_key(&self) -> &HpkePublicKey

Get a reference to the HPKE public key of this key pair.

source

pub fn into_keys(self) -> (HpkePrivateKey, HpkePublicKey)

Split the key pair into the two keys

source

pub fn from_keys(private_key: HpkePrivateKey, public_key: HpkePublicKey) -> Self

Build a key pair from two keys

Trait Implementations§

source§

impl Debug for HpkeKeyPair

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for HpkeKeyPair

source§

fn default() -> HpkeKeyPair

Returns the “default value” for a type. Read more
source§

impl From<(&[u8], &[u8])> for HpkeKeyPair

source§

fn from((sk, pk): (&[u8], &[u8])) -> Self

Converts to this type from the input type.
source§

impl From<(Vec<u8>, Vec<u8>)> for HpkeKeyPair

source§

fn from((sk, pk): (Vec<u8>, Vec<u8>)) -> Self

Converts to this type from the input type.

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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.