ddn.net.tls.tls12
TLS 1.2 handshake engine (RFC 5246).
Implements TLS 1.2 client and server handshakes as resumable state machines with ECDHE key exchange and AES-GCM cipher suites.
Types 4
TLS 1.2 client handshake phases.
Each phase represents a discrete step in the client handshake state machine. The handshake progresses forward through these phases.
TLS 1.2 client handshake engine.
Drives the client side of a TLS 1.2 handshake over a record layer using a resumable state machine. After successful handshake, provides the AEAD cipher and negotiated parameters for application data exchange.
Call handshake() repeatedly until it returns TlsProgress.DONE.
private RecordLayer recordLayer_private Tls12Prf prf_private TranscriptHash transcript_private string serverName_private TlsVerifyMode verifyMode_private TlsVerifyCallback verifyCallback_private string[] alpnProtocols_private NativeTlsTrustStore trustStore_private string negotiatedAlpn_private CipherSuiteId negotiatedCipher_private ProtocolVersion negotiatedVersion_private ubyte[32] clientRandom_private ubyte[32] serverRandom_private ubyte[] preMasterSecret_private ubyte[] masterSecret_private X25519PrivateKey ecdhePrivate_private EcdhP256Store * ecdhP256Store_private NamedGroup selectedGroup_private TlsCertificateChain peerCerts_private TlsSession tlsSession_private TlsAead clientWriteAead_private TlsAead serverReadAead_private Tls12HandshakePhase phase_private SecureRandom rng_TlsProgress handshake()Performs or continues the TLS 1.2 client handshake.ubyte[] buildClientHello(SecureRandom rng)void processServerHello(TlsRecord rec)void processCertificate(TlsRecord rec)void verifyPeerCertificates()void processServerKeyExchange(TlsRecord rec)void verifyServerKeyExchangeSignature(SignatureScheme sigScheme,
const(ubyte)[] signature, const(ubyte)[] message)void processServerHelloDone(TlsRecord rec)void updateTranscriptAndPushRemaining(TlsRecord rec, const(ubyte)[] data)ubyte[] buildClientKeyExchange()void deriveKeys()ubyte[] buildFinished()void processChangeCipherSpec(TlsRecord rec)void processServerFinished(TlsRecord rec)ubyte[] encryptRecord(ubyte[] handshakeMsg, TlsAead aead)Tls13TrafficKeys makeTrafficKeys(const(ubyte)[] key, const(ubyte)[] iv, size_t keyLen) staticthis(RecordLayer recordLayer, string serverName,
TlsVerifyMode verifyMode, TlsVerifyCallback verifyCallback,
string[] alpnProtocols, NativeTlsTrustStore trustStore = null)Constructs a TLS 1.2 client handshake engine.EcdhP256StoreHeap storage for EcdhP256 since it's a struct.TLS 1.2 server handshake phases.
Each phase represents a discrete step in the server handshake state machine. The handshake progresses forward through these phases.
TLS 1.2 server handshake engine.
Drives the server side of a TLS 1.2 handshake over a record layer using a resumable state machine. After successful handshake, provides the AEAD ciphers and negotiated parameters for application data exchange.
Call handshake() repeatedly until it returns TlsProgress.DONE.
private RecordLayer recordLayer_private Tls12Prf prf_private TranscriptHash transcript_private TlsVerifyMode verifyMode_private TlsVerifyCallback verifyCallback_private string[] alpnProtocols_private string negotiatedAlpn_private CipherSuiteId negotiatedCipher_private ProtocolVersion negotiatedVersion_private string serverName_private TlsCertificateChain peerCerts_private TlsSession tlsSession_private ubyte[32] clientRandom_private ubyte[32] serverRandom_private ubyte[] preMasterSecret_private ubyte[] masterSecret_private X25519PrivateKey ecdhePrivate_private TlsAead clientReadAead_private TlsAead serverWriteAead_private ubyte[][] serverCertChainDer_private string serverPrivateKeyPem_private PrivateKey privateKey_private SignatureScheme sigScheme_private Tls12ServerHandshakePhase phase_private SecureRandom rng_TlsProgress handshake()Performs or continues the TLS 1.2 server handshake.void processClientHello(TlsRecord rec)void parseServerName(const(ubyte)[] extData)void parseClientAlpn(const(ubyte)[] extData)void selectCipherSuite(CipherSuiteId[] clientCiphers)ubyte[] buildServerHello(SecureRandom rng)ubyte[] buildCertificate()ubyte[] buildServerKeyExchange(SecureRandom rng)ubyte[] buildServerHelloDone()void processClientKeyExchange(TlsRecord rec)void deriveKeys()void processChangeCipherSpec(TlsRecord rec)void processClientFinished(TlsRecord rec)ubyte[] buildServerFinished()ubyte[] encryptRecord(ubyte[] handshakeMsg, TlsAead aead)void parsePrivateKey()ubyte[] computeSignature(const(ubyte)[] message)this(RecordLayer recordLayer, TlsVerifyMode verifyMode,
TlsVerifyCallback verifyCallback, string[] alpnProtocols,
ubyte[][] certChainDer, string certChainPem, string privateKeyPem)Constructs a TLS 1.2 server handshake engine.Functions 1
bool verifyRsaPkcs1Signature(RSAPublicKey key, SignatureScheme sigScheme,
const(ubyte)[] message, const(ubyte)[] signature)Verifies an RSA PKCS#1 v1.5 signature for TLS 1.2 `ServerKeyExchange`.