mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-11-05 04:03:59 +08:00
40 lines
915 B
Rust
40 lines
915 B
Rust
#[cfg(test)]
|
|
mod extension_use_extended_master_secret_test;
|
|
|
|
use super::*;
|
|
|
|
const EXTENSION_USE_EXTENDED_MASTER_SECRET_HEADER_SIZE: usize = 4;
|
|
|
|
/// ## Specifications
|
|
///
|
|
/// * [RFC 8422]
|
|
///
|
|
/// [RFC 8422]: https://tools.ietf.org/html/rfc8422
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
pub struct ExtensionUseExtendedMasterSecret {
|
|
pub(crate) supported: bool,
|
|
}
|
|
|
|
impl ExtensionUseExtendedMasterSecret {
|
|
pub fn extension_value(&self) -> ExtensionValue {
|
|
ExtensionValue::UseExtendedMasterSecret
|
|
}
|
|
|
|
pub fn size(&self) -> usize {
|
|
2
|
|
}
|
|
|
|
pub fn marshal<W: Write>(&self, writer: &mut W) -> Result<()> {
|
|
// length
|
|
writer.write_u16::<BigEndian>(0)?;
|
|
|
|
Ok(writer.flush()?)
|
|
}
|
|
|
|
pub fn unmarshal<R: Read>(reader: &mut R) -> Result<Self> {
|
|
let _ = reader.read_u16::<BigEndian>()?;
|
|
|
|
Ok(ExtensionUseExtendedMasterSecret { supported: true })
|
|
}
|
|
}
|