pub struct SenderContext(/* private fields */);Expand description
HPKE sender context. Callers may use seal() to encrypt messages for the recipient.
Implementations§
Source§impl SenderContext
impl SenderContext
Sourcepub fn new(
params: &Params,
recipient_pub_key: &[u8],
info: &[u8],
) -> Option<(Self, Vec<u8>)>
pub fn new( params: &Params, recipient_pub_key: &[u8], info: &[u8], ) -> Option<(Self, Vec<u8>)>
Performs the SetupBaseS HPKE operation and returns a sender context
plus an encapsulated shared secret for recipient_pub_key.
Returns None if recipient_pub_key is invalid.
On success, callers may use seal() to encrypt messages for the recipient.
Sourcepub fn seal(&mut self, plaintext: &[u8], aad: &[u8]) -> Vec<u8>
pub fn seal(&mut self, plaintext: &[u8], aad: &[u8]) -> Vec<u8>
Seal encrypts plaintext, and authenticates aad, returning the resulting ciphertext.
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.
This function panics if adding the plaintext length and
bssl_sys::EVP_HPKE_CTX_max_overhead overflows.
Auto Trait Implementations§
impl Freeze for SenderContext
impl RefUnwindSafe for SenderContext
impl Send for SenderContext
impl !Sync for SenderContext
impl Unpin for SenderContext
impl UnsafeUnpin for SenderContext
impl UnwindSafe for SenderContext
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