Trait HpkeContextR

Source
pub trait HpkeContextR {
    type Error: IntoAnyError;

    // Required methods
    fn open(
        &mut self,
        aad: Option<&[u8]>,
        ciphertext: &[u8],
    ) -> Result<Vec<u8>, Self::Error>;
    fn export(
        &self,
        exporter_context: &[u8],
        len: usize,
    ) -> Result<Vec<u8>, Self::Error>;
}
Expand description

The HPKE context for receiver outputted by hpke_setup_r. The context internally stores secrets received from the sender by hpke_setup_r.

This trait corresponds to ContextR from RFC 9180.

Required Associated Types§

Required Methods§

Source

fn open( &mut self, aad: Option<&[u8]>, ciphertext: &[u8], ) -> Result<Vec<u8>, Self::Error>

Decrypt ciphertext using the cipher key of the context with optional aad. This function should internally increment the sequence number.

Source

fn export( &self, exporter_context: &[u8], len: usize, ) -> Result<Vec<u8>, Self::Error>

Export a secret from the context for the given exporter_context.

Implementors§