TLS Codec
This crate implements the TLS codec as defined in RFC 8446 as well as some extensions required by MLS.
With the feature derive
TlsSerialize
, TlsDeserialize
, and TlsSize
can be derived.
Note that TlsSerialize
and TlsDeserialize
both require TlsSize
.
This crate provides the following data structures that implement TLS serialization/deserialization
u8
,u16
,u32
,u64
TlsVecU8
,TlsVecU16
,TlsVecU32
SecretTlsVecU8
,SecretTlsVecU16
,SecretTlsVecU32
The same as theTlsVec*
versions but it implements zeroize, requiring the elements to implement zeroize as well.TlsSliceU8
,TlsSliceU16
,TlsSliceU32
are lightweight wrapper for slices that allow to serialize them without having to create aTlsVec*
.TlsByteSliceU8
,TlsByteSliceU16
,TlsByteSliceU32
, andTlsByteVecU8
,TlsByteVecU16
,TlsByteVecU32
are provided with optimized implementations for byte vectors.[u8; l]
, forl ∈ [1..128]
- Serialize for
Option<T>
whereT: Serialize
- Deserialize for
Option<T>
whereT: Deserialize
- Serialize for
(T, U)
and(T, U, V)
whereT, U, V
implement Serialize` - Deserialize for
(T, U)
and(T, U, V)
whereT, U, V
implement Deserialize`
Usage
use ;
let mut b = & as &;
let a = u8 tls_deserialize.expect;
assert_eq!;
println!;
let v = tls_deserialize.expect;
assert_eq!;