Trait quinn::crypto::Session [−][src]
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
pub fn initial_keys(dst_cid: &ConnectionId, side: Side) -> Keys<Self>
[src]
Create the initial set of keys given the client’s initial destination ConnectionId
pub fn handshake_data(&self) -> Option<Self::HandshakeData>
[src]
Get data negotiated during the handshake, if available
Returns None
until the connection emits HandshakeDataReady
.
pub fn peer_identity(&self) -> Option<Self::Identity>
[src]
Get the peer’s identity, if available
pub 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.
pub fn early_data_accepted(&self) -> Option<bool>
[src]
If the 0-RTT-encrypted data has been accepted by the peer
pub fn is_handshaking(&self) -> bool
[src]
Returns true
until the connection is fully established.
pub fn read_handshake(&mut self, buf: &[u8]) -> Result<bool, Error>
[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.
pub fn transport_parameters(&self) -> Result<Option<TransportParameters>, Error>
[src]
The peer’s QUIC transport parameters
These are only available after the first flight from the peer has been received.
pub fn write_handshake(
&mut self,
buf: &mut Vec<u8, Global>
) -> Option<Keys<Self>>
[src]
&mut self,
buf: &mut Vec<u8, Global>
) -> Option<Keys<Self>>
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.
pub fn next_1rtt_keys(&mut self) -> KeyPair<Self::PacketKey>
[src]
Compute keys for the next key update
pub fn retry_tag(orig_dst_cid: &ConnectionId, packet: &[u8]) -> [u8; 16]
[src]
Generate the integrity tag for a retry packet
pub 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
pub 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]
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>
pub fn initial_keys(dst_cid: &ConnectionId, side: Side) -> Keys<TlsSession>
[src]
pub fn handshake_data(&self) -> Option<HandshakeData>
[src]
pub fn peer_identity(&self) -> Option<CertificateChain>
[src]
pub fn early_crypto(
&self
) -> Option<(<TlsSession as Session>::HeaderKey, <TlsSession as Session>::PacketKey)>
[src]
&self
) -> Option<(<TlsSession as Session>::HeaderKey, <TlsSession as Session>::PacketKey)>
pub fn early_data_accepted(&self) -> Option<bool>
[src]
pub fn is_handshaking(&self) -> bool
[src]
pub fn read_handshake(&mut self, buf: &[u8]) -> Result<bool, Error>
[src]
pub fn transport_parameters(&self) -> Result<Option<TransportParameters>, Error>
[src]
pub fn write_handshake(
&mut self,
buf: &mut Vec<u8, Global>
) -> Option<Keys<TlsSession>>
[src]
&mut self,
buf: &mut Vec<u8, Global>
) -> Option<Keys<TlsSession>>
pub fn next_1rtt_keys(&mut self) -> KeyPair<<TlsSession as Session>::PacketKey>
[src]
pub fn retry_tag(orig_dst_cid: &ConnectionId, packet: &[u8]) -> [u8; 16]
[src]
pub fn is_valid_retry(
orig_dst_cid: &ConnectionId,
header: &[u8],
payload: &[u8]
) -> bool
[src]
orig_dst_cid: &ConnectionId,
header: &[u8],
payload: &[u8]
) -> bool
pub 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>