Trait quinn_proto::crypto::Session [−][src]
pub trait Session: Send + Sized { type HandshakeData; type Identity: Sized; type ClientConfig: ClientConfig<Self>; type HmacKey: HmacKey; type HandshakeTokenKey: HandshakeTokenKey; type HeaderKey: HeaderKey; type PacketKey: PacketKey; type ServerConfig: ServerConfig<Self>;}Show methods
fn initial_keys(dst_cid: &ConnectionId, side: Side) -> Keys<Self>; fn handshake_data(&self) -> Option<Self::HandshakeData>; fn peer_identity(&self) -> Option<Self::Identity>; fn early_crypto(&self) -> Option<(Self::HeaderKey, Self::PacketKey)>; fn early_data_accepted(&self) -> Option<bool>; fn is_handshaking(&self) -> bool; fn read_handshake(&mut self, buf: &[u8]) -> Result<bool, TransportError>; fn transport_parameters(
&self
) -> Result<Option<TransportParameters>, TransportError>; fn write_handshake(&mut self, buf: &mut Vec<u8>) -> Option<Keys<Self>>; fn next_1rtt_keys(&mut self) -> KeyPair<Self::PacketKey>; fn retry_tag(orig_dst_cid: &ConnectionId, packet: &[u8]) -> [u8; 16]; fn is_valid_retry(
orig_dst_cid: &ConnectionId,
header: &[u8],
payload: &[u8]
) -> bool; fn export_keying_material(
&self,
output: &mut [u8],
label: &[u8],
context: &[u8]
) -> Result<(), ExportKeyingMaterialError>;
A cryptographic session (commonly TLS)
Associated Types
type HandshakeData[src]
Parameters determined when the handshake begins, e.g. server name and/or application protocol
type Identity: Sized[src]
Cryptographic identity of the peer
type ClientConfig: ClientConfig<Self>[src]
Type used to hold configuration for client sessions
type HmacKey: HmacKey[src]
Type used to sign various values
type HandshakeTokenKey: HandshakeTokenKey[src]
Key used to generate one-time-use handshake token keys
type HeaderKey: HeaderKey[src]
Type of keys used to protect packet headers
type PacketKey: PacketKey[src]
Type used to represent packet protection keys
type ServerConfig: ServerConfig<Self>[src]
Type used to hold configuration for server sessions
Required methods
fn initial_keys(dst_cid: &ConnectionId, side: Side) -> Keys<Self>[src]
Create the initial set of keys given the client’s initial destination ConnectionId
fn handshake_data(&self) -> Option<Self::HandshakeData>[src]
Get data negotiated during the handshake, if available
Returns None until the connection emits HandshakeDataReady.
fn peer_identity(&self) -> Option<Self::Identity>[src]
Get the peer’s identity, if available
fn early_crypto(&self) -> Option<(Self::HeaderKey, Self::PacketKey)>[src]
Get the 0-RTT keys if available (clients only)
On the client side, this method can be used to see if 0-RTT key material is available to start sending data before the protocol handshake has completed.
Returns None if the key material is not available. This might happen if you have
not connected to this server before.
fn early_data_accepted(&self) -> Option<bool>[src]
If the 0-RTT-encrypted data has been accepted by the peer
fn is_handshaking(&self) -> bool[src]
Returns true until the connection is fully established.
fn read_handshake(&mut self, buf: &[u8]) -> Result<bool, TransportError>[src]
Read bytes of handshake data
This should be called with the contents of CRYPTO frames. If it returns Ok, the
caller should call write_handshake() to check if the crypto protocol has anything
to send to the peer.
On success, returns true iff self.handshake_data() has been populated.
fn transport_parameters(
&self
) -> Result<Option<TransportParameters>, TransportError>[src]
&self
) -> Result<Option<TransportParameters>, TransportError>
The peer’s QUIC transport parameters
These are only available after the first flight from the peer has been received.
fn write_handshake(&mut self, buf: &mut Vec<u8>) -> Option<Keys<Self>>[src]
Writes handshake bytes into the given buffer and optionally returns the negotiated keys
When the handshake proceeds to the next phase, this method will return a new set of keys to encrypt data with.
fn next_1rtt_keys(&mut self) -> KeyPair<Self::PacketKey>[src]
Compute keys for the next key update
fn retry_tag(orig_dst_cid: &ConnectionId, packet: &[u8]) -> [u8; 16][src]
Generate the integrity tag for a retry packet
fn is_valid_retry(
orig_dst_cid: &ConnectionId,
header: &[u8],
payload: &[u8]
) -> bool[src]
orig_dst_cid: &ConnectionId,
header: &[u8],
payload: &[u8]
) -> bool
Verify the integrity of a retry packet
fn export_keying_material(
&self,
output: &mut [u8],
label: &[u8],
context: &[u8]
) -> Result<(), ExportKeyingMaterialError>[src]
&self,
output: &mut [u8],
label: &[u8],
context: &[u8]
) -> Result<(), ExportKeyingMaterialError>
Fill output with output.len() bytes of keying material derived
from the Session’s secrets, using label and context for domain
separation.
This function will fail, returning ExportKeyingMaterialError, if the requested output length is too large.
Implementors
impl Session for TlsSession[src]
impl Session for TlsSession[src]type HandshakeData = HandshakeData
type Identity = CertificateChain
type ClientConfig = Arc<ClientConfig>
type HmacKey = Key
type HandshakeTokenKey = Prk
type PacketKey = PacketKey
type HeaderKey = HeaderProtectionKey
type ServerConfig = Arc<ServerConfig>
fn initial_keys(dst_cid: &ConnectionId, side: Side) -> Keys<Self>[src]
fn handshake_data(&self) -> Option<HandshakeData>[src]
fn peer_identity(&self) -> Option<CertificateChain>[src]
fn early_crypto(&self) -> Option<(Self::HeaderKey, Self::PacketKey)>[src]
fn early_data_accepted(&self) -> Option<bool>[src]
fn is_handshaking(&self) -> bool[src]
fn read_handshake(&mut self, buf: &[u8]) -> Result<bool, TransportError>[src]
fn transport_parameters(
&self
) -> Result<Option<TransportParameters>, TransportError>[src]
&self
) -> Result<Option<TransportParameters>, TransportError>
fn write_handshake(&mut self, buf: &mut Vec<u8>) -> Option<Keys<Self>>[src]
fn next_1rtt_keys(&mut self) -> KeyPair<Self::PacketKey>[src]
fn retry_tag(orig_dst_cid: &ConnectionId, packet: &[u8]) -> [u8; 16][src]
fn is_valid_retry(
orig_dst_cid: &ConnectionId,
header: &[u8],
payload: &[u8]
) -> bool[src]
orig_dst_cid: &ConnectionId,
header: &[u8],
payload: &[u8]
) -> bool
fn export_keying_material(
&self,
output: &mut [u8],
label: &[u8],
context: &[u8]
) -> Result<(), ExportKeyingMaterialError>[src]
&self,
output: &mut [u8],
label: &[u8],
context: &[u8]
) -> Result<(), ExportKeyingMaterialError>