[−][src]Trait quinn::crypto::Session
A cryptographic session (commonly TLS)
Associated Types
type AuthenticationData: Sized
Data conveyed by the peer during the handshake, including cryptographic identity
type ClientConfig: ClientConfig<Self>
Type used to hold configuration for client sessions
type HmacKey: HmacKey
Type used to sign various values
type Keys: Keys
Type used to represent packet protection keys
type ServerConfig: ServerConfig<Self>
Type used to hold configuration for server sessions
Required methods
fn authentication_data(&self) -> Self::AuthenticationData
Get the data agreed upon during the cryptographic handshake
For TLS, this includes the peer's certificates, the negotiated protocol and the hostname indicated by the client. Note that this data may be incomplete while the handshake is still in progress; only call it after the connection is established to get the full data.
fn early_crypto(&self) -> Option<Self::Keys>
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>
If the 0-RTT-encrypted data has been accepted by the peer
fn is_handshaking(&self) -> bool
Returns true
until the connection is fully established.
fn read_handshake(&mut self, buf: &[u8]) -> Result<(), Error>
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.
fn transport_parameters(&self) -> Result<Option<TransportParameters>, Error>
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<Self::Keys>
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 update_keys(&self, keys: &Self::Keys) -> Self::Keys
Update the given set of keys
fn retry_tag(orig_dst_cid: &ConnectionId, packet: &[u8]) -> [u8; 16]
Generate the integrity tag for a retry packet
fn is_valid_retry(
orig_dst_cid: &ConnectionId,
header: &[u8],
payload: &[u8]
) -> bool
orig_dst_cid: &ConnectionId,
header: &[u8],
payload: &[u8]
) -> bool
Verify the integrity of a retry packet
Implementors
impl Session for TlsSession
[src]
type AuthenticationData = AuthenticationData
type ClientConfig = Arc<ClientConfig>
type HmacKey = Key
type Keys = Crypto
type ServerConfig = Arc<ServerConfig>
fn authentication_data(&self) -> AuthenticationData
[src]
fn early_crypto(&self) -> Option<<TlsSession as Session>::Keys>
[src]
fn early_data_accepted(&self) -> Option<bool>
[src]
fn is_handshaking(&self) -> bool
[src]
fn read_handshake(&mut self, buf: &[u8]) -> Result<(), Error>
[src]
fn transport_parameters(&self) -> Result<Option<TransportParameters>, Error>
[src]
fn write_handshake(
&mut self,
buf: &mut Vec<u8>
) -> Option<<TlsSession as Session>::Keys>
[src]
&mut self,
buf: &mut Vec<u8>
) -> Option<<TlsSession as Session>::Keys>
fn update_keys(
&self,
keys: &<TlsSession as Session>::Keys
) -> <TlsSession as Session>::Keys
[src]
&self,
keys: &<TlsSession as Session>::Keys
) -> <TlsSession as Session>::Keys
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