Skip to main content

hpke_dispatch/
ciphertext.rs

1/// Encapsulated key and ciphertext.
2///
3/// Obtained from [`crate::base_mode_seal::base_mode_seal`].
4#[derive(Debug, Clone, PartialEq, Eq)]
5pub struct EncappedKeyAndCiphertext {
6    /// The encapsulated encryption key
7    pub encapped_key: Vec<u8>,
8
9    /// The ciphertext, encrypted with the key
10    pub ciphertext: Vec<u8>,
11}
12
13impl EncappedKeyAndCiphertext {
14    /// returns (encapsulated key, ciphertext)
15    #[must_use]
16    pub fn into_parts(self) -> (Vec<u8>, Vec<u8>) {
17        (self.encapped_key, self.ciphertext)
18    }
19}