pub struct RecipientContext(/* private fields */);Expand description
HPKE recipient context. Callers may use open() to decrypt messages from the sender.
Implementations§
Source§impl RecipientContext
impl RecipientContext
Sourcepub fn new(
params: &Params,
recipient_priv_key: &[u8],
encapsulated_key: &[u8],
info: &[u8],
) -> Option<Self>
pub fn new( params: &Params, recipient_priv_key: &[u8], encapsulated_key: &[u8], info: &[u8], ) -> Option<Self>
New implements the SetupBaseR HPKE operation, which decapsulates the shared secret in
encapsulated_key with recipient_priv_key and sets up a recipient context. These are
stored and returned in the newly created RecipientContext.
Note that encapsulated_key may be invalid, in which case this function will return an
error.
On success, callers may use open() to decrypt messages from the sender.
Sourcepub fn open(&mut self, ciphertext: &[u8], aad: &[u8]) -> Option<Vec<u8>>
pub fn open(&mut self, ciphertext: &[u8], aad: &[u8]) -> Option<Vec<u8>>
Open authenticates aad and decrypts ciphertext. It returns an error on failure.
Note that HPKE encryption is stateful and ordered. The sender’s first call to seal() must
correspond to the recipient’s first call to open(), etc.
Auto Trait Implementations§
impl Freeze for RecipientContext
impl RefUnwindSafe for RecipientContext
impl Send for RecipientContext
impl !Sync for RecipientContext
impl Unpin for RecipientContext
impl UnsafeUnpin for RecipientContext
impl UnwindSafe for RecipientContext
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