struct KeySchedule {
current: Box<dyn HkdfExpander>,
inner: KeyScheduleSuite,
}
Expand description
This is the TLS1.3 key schedule. It stores the current secret and the type of hash. This isn’t used directly; but only through the typestates.
Fields§
§current: Box<dyn HkdfExpander>
§inner: KeyScheduleSuite
Implementations§
Source§impl KeySchedule
impl KeySchedule
fn new(suite: &'static Tls13CipherSuite, secret: &[u8]) -> Self
Sourcefn new_with_empty_secret(suite: &'static Tls13CipherSuite) -> Self
fn new_with_empty_secret(suite: &'static Tls13CipherSuite) -> Self
Creates a key schedule without a PSK.
Sourcefn input_empty(&mut self)
fn input_empty(&mut self)
Input the empty secret.
RFC 8446: “If a given secret is not available, then the 0-value consisting of a string of Hash.length bytes set to zeros is used.”
Sourcefn input_secret(&mut self, secret: &[u8])
fn input_secret(&mut self, secret: &[u8])
Input the given secret.
Sourcefn derive(&self, kind: SecretKind, hs_hash: &[u8]) -> OkmBlock
fn derive(&self, kind: SecretKind, hs_hash: &[u8]) -> OkmBlock
Derive a secret of given kind
, using current handshake hash hs_hash
.
More specifically
Derive-Secret(., "derived", Messages)
where hs_hash
is Messages
.
fn derive_logged_secret( &self, kind: SecretKind, hs_hash: &[u8], key_log: &dyn KeyLog, client_random: &[u8; 32], ) -> OkmBlock
Sourcefn derive_for_empty_hash(&self, kind: SecretKind) -> OkmBlock
fn derive_for_empty_hash(&self, kind: SecretKind) -> OkmBlock
Derive a secret of given kind
using the hash of the empty string
for the handshake hash.
More specifically:
Derive-Secret(., Label, "")
where kind
is Label
.
Useful only for the following SecretKind
s:
SecretKind::ExternalPskBinderKey
SecretKind::ResumptionPSKBinderKey
SecretKind::DerivedSecret
Methods from Deref<Target = KeyScheduleSuite>§
fn set_encrypter(&self, secret: &OkmBlock, common: &mut CommonState)
fn set_decrypter(&self, secret: &OkmBlock, common: &mut CommonState)
fn derive_decrypter(&self, secret: &OkmBlock) -> Box<dyn MessageDecrypter>
Sourcefn sign_finish(&self, base_key: &OkmBlock, hs_hash: &Output) -> Tag
fn sign_finish(&self, base_key: &OkmBlock, hs_hash: &Output) -> Tag
Sign the finished message consisting of hs_hash
using a current
traffic secret.
See RFC 8446 section 4.4.4.
Sourcefn sign_verify_data(&self, base_key: &OkmBlock, hs_hash: &Output) -> Tag
fn sign_verify_data(&self, base_key: &OkmBlock, hs_hash: &Output) -> Tag
Sign the finished message consisting of hs_hash
using the key material
base_key
.
See RFC 8446 section 4.4.4.
Sourcefn derive_next(&self, base_key: &OkmBlock) -> OkmBlock
fn derive_next(&self, base_key: &OkmBlock) -> OkmBlock
Derive the next application traffic secret, returning it.
Sourcefn derive_ticket_psk(&self, rms: &OkmBlock, nonce: &[u8]) -> OkmBlock
fn derive_ticket_psk(&self, rms: &OkmBlock, nonce: &[u8]) -> OkmBlock
Derive the PSK to use given a resumption_master_secret and ticket_nonce.