KeySpace

Struct KeySpace 

Source
pub struct KeySpace {
    pub cipher: Cipher,
    pub secret: Vec<u8>,
    pub record_count: u64,
    pub key_epoch: Option<usize>,
}
Expand description

KeySpace represents the decryption context of some keys.

E.g. Handshake Space or Traffic Space.

Fields§

§cipher: Cipher§secret: Vec<u8>§record_count: u64§key_epoch: Option<usize>

Defined for application traffic

Implementations§

Source§

impl KeySpace

Source

pub fn handshake_traffic_secret(secret: Vec<u8>, cipher: Cipher) -> Self

Construct a new key space from a handshake secret

Source

pub fn first_traffic_secret(secret: Vec<u8>, cipher: Cipher) -> Self

Construct a new key space from the first traffic secret

Source

pub fn key_update(&self) -> Self

Construct a new key space following a key update

Defined in https://www.rfc-editor.org/rfc/rfc8446#section-7.2

Source

pub fn traffic_key(&self) -> Result<(Vec<u8>, Vec<u8>)>

Return the actual key and IV which will be used the the symmetric cipher

Source

pub fn decrypt_record( &mut self, header: &RecordHeader, record: &[u8], ) -> Vec<u8>

  • record: the encrypted record, exclusive of the header
  • sender: the party who transmitted the record

Trait Implementations§

Source§

impl Debug for KeySpace

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more