#[derive(Clone)] pubenum HpKey { /// An AES encryption context. /// Note: as we need to clone this object, we clone the pointer and /// track references using `Rc`. `PK11Context` can't be used with `PK11_CloneContext` /// as that is not supported for these contexts.
Aes(Rc<RefCell<Context>>), /// The `ChaCha20` mask has to invoke a new `PK11_Encrypt` every time as it needs to /// change the counter and nonce on each invocation.
Chacha(SymKey),
}
/// QUIC-specific API for extracting a header-protection key. /// /// # Errors /// /// Errors if HKDF fails or if the label is too long to fit in a `c_uint`. /// /// # Panics /// /// When `cipher` is not known to this code. pubfn extract(version: Version, cipher: Cipher, prk: &SymKey, label: &str) -> Res<Self> { const ZERO: &[u8] = &[0; 12];
let l = label.as_bytes(); letmut secret: *mut PK11SymKey = null_mut();
/// Generate a header protection mask for QUIC. /// /// # Errors /// /// An error is returned if the NSS functions fail; a sample of the /// wrong size is the obvious cause. /// /// # Panics /// /// When the mechanism for our key is not supported. /// Or when the sample provided is not at least `self.sample_size()` bytes. pubfn mask(&self, sample: &[u8]) -> Res<[u8; Self::SAMPLE_SIZE]> { letmut output = [0; Self::SAMPLE_SIZE];
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.