Traits

Traits are the ❤️ of everything

In order to provide non-monolithic de-coupling, traits are everywhere.

Builder traits

Builder traits are involved in the record generation and provides callbacks to provide data upon construction before they are pushed into the wire

You can find them here: traits/src/t_builder.rs

TraitDescription
HandshakeBuilderConstruct handshakes e.g. ServerHello
WrappedApplicationBuilderFor the user (application) traffic
WrappedHandshakeBuilderWrapped (protected) handshakes
Server[..]BuilderServer protected handshake messages

Cryptography traits

Found here: traits/src/t_crypto.rs

Example impl: crypto/rustcrypto

Context usage example: server/examples/listener.rs

Processor config example: crypto/rustcrypto/src/lib.rs

Validation through trait impl. validation/crypto

TraitDescription
CryptoConfigCrypto processor implements for end-user to BYOC
CryptoSignerP[..]ProcessorSignature processors
Crypto[..]HmacProcessorHMAC Processors
Crypto[..]HkdfExtractProcessorHKDF Extract Processors
Crypto[..]HkdfGenProcessorHKDF Expand Processors
CryptoX25519ProcessorECDHE X25519 Processor
Crypto[..]TranscriptProcessorTranscript hashing Processors
CryptoChaCha20Poly1305ProcessorChaCha20Poly1305 AEAD Processor

Context

Context is the stateful TLS context that is wound forward with data providing the protocol state machine.

Found here: traits/src/t_ctx.rs

Example impls: server/src

These are implemented in the contextes but they are de-coupled.

TraitDescription
CtxHandshakeProcessorImplement to provide processing for handshake
CtxApplicationProcessorImplement to provide processing for application traffic

Input / Output

We have Left and Right sides for I/O where typically the Left is the Ciphertext Network I/O side and the right being side being the Application I/O for Cleartext.

The traits can be found here: traits/src/t_io.rs

Example naive I/O impl found here: server/examples/listener.rs

The I/O reflects how Left/Right also works in yaws.

To "hook" I/O or integration with the given I/O traits the following traits are implemented somewhere the I/O is concerned.

TraitDescription
TlsLeftOutLeft (Ciphertext) or "Network" I/O egress side
TlsLeftInsame as TlsLeftOut but Network ingress
TlsRightRight (Cleartext) or "Application" I/O side

Keying

Traits for keys provides key / schedule operations.

Found from here: traits/src/t_keys.rs

Implemented here for TLS 1.3: keys/src/tls13_key_schedule.rs

TraitDescription
SecretStoreUsed to store derived Application traffic keys
Tls13KeySchedule[..]Key schedule operation states

Parsing

Found here: [traits/src/t_parser.rs]

TraitDescription
ClientHelloProcessorClient Hello parsing