Documentation
¶
Overview ¶
Package tlsx is a fork of the crypto/tls package of the Go standard library (Go 1.27.1; BSD-3-Clause licence, see LICENSE, NOTICE and UPSTREAM.md) with TLS features crypto/tls does not have, for protocols that require them: industrial and utility profiles such as IEC 62351-3, device-management stacks that use pre-shared keys or raw public keys (for example oneM2M TS-0003), and meter or field-bus gateways. It is maintained independently and is not part of, or endorsed by, the Go project.
Why a copy of crypto/tls ¶
The other candidate was github.com/refraction-networking/utls (BSD-3). It exists to imitate other clients' ClientHellos; it is a fork of crypto/tls that trails upstream by releases and adds a large surface we do not need, and it implements none of the gaps below (no server renegotiation, no KeyUpdate API, no DHE, no encrypt_then_mac, no brainpool). Starting from it would mean two forks to follow. A copy of the standard library's package, rewritten only where it reaches into internal packages, keeps the diff against upstream small and is synced with scripts/sync-upstream.sh.
What tlsx adds ¶
With a zero Config.Ext and the default cipher suites and groups, tlsx behaves as crypto/tls of Go 1.27.1 (its upstream tests run, with the exceptions listed in UPSTREAM.md). The additions are opt-in:
- TLS 1.3 key update on demand: Conn.SendKeyUpdate (RFC 8446 4.6.3); counts and times in ConnectionState().Ext, events through Config.Ext.Observer. Config.Ext.MinKeyUpdateInterval accepts a peer's timed updates on an idle connection, which crypto/tls drops after 16.
- TLS 1.2 secure renegotiation (RFC 5746) in both roles: Conn.Renegotiate (full, certificates validated again), Conn.Resume (abbreviated: the session resumed on the connection for new keys), Conn.RequestRenegotiation (server HelloRequest) and Config.Ext.AcceptRenegotiation. Renegotiation is refused with a peer that did not signal RFC 5746, keeps the version and the peer's leaf certificate, runs on whichever goroutine holds the connection's read side, and holds our writes while it runs.
- Cipher suites TLS_DHE_RSA_WITH_AES_128/256_GCM (RFC 5288) on the RFC 7919 groups only; TLS_ECDHE_*_WITH_AES_256_CBC_SHA384 (RFC 5289); TLS_AES_128_CCM_SHA256 and TLS_AES_128_CCM_8_SHA256 (Config.Ext.CipherSuitesTLS13; internal/ccm); the integrity-only TLS 1.3 suites TLS_SHA256_SHA256 and TLS_SHA384_SHA384 (RFC 9150), which give no confidentiality, and the TLS 1.2 TLS_RSA_WITH_NULL_SHA256 (Config.CipherSuites).
- encrypt_then_mac (RFC 7366) for every CBC suite (Config.Ext.EncryptThenMAC, RequireEncryptThenMAC).
- Groups ffdhe2048/3072/4096 (RFC 7919; TLS 1.3 key shares and TLS 1.2 DHE) and brainpoolP256r1/P384r1/P512r1 (TLS 1.2 ECDHE, RFC 7027; TLS 1.3, RFC 8734), with ECDSA certificates and keys on the brainpool curves, when listed in Config.CurvePreferences.
- Signature schemes rsa_pss_pss_sha256/384/512 and the brainpool TLS 1.3 schemes, offered through Config.Ext.SignatureSchemes; RSASSA-PSS keys also as CA keys (fill pools with AppendCertsFromPEM).
- status_request_v2 (RFC 6961, ocsp_multi; Config.Ext.RequestOCSPMulti and Certificate.ChainOCSPStaples) and per-certificate OCSP in TLS 1.3 (RFC 8446 4.4.2.1), both directions; ConnectionState().Ext.OCSPResponses.
- trusted_ca_keys (RFC 6066 6; Config.Ext.TrustedCAKeys, TrustedAuthoritiesFor, TrustedAuthoritiesMatch) and certificate_authorities in the ClientHello (RFC 8446 4.2.4; Config.Ext.CertificateAuthorities).
- max_fragment_length (RFC 6066 4), honoured by servers and requested by Config.Ext.MaxFragmentLength.
- TLS 1.2 resumption by session ID (Config.Ext.ServerSessionCache, ClientSessionIDs).
- ClientHelloInfo.Ext: psk_key_exchange_modes, the extensions above, and whether the hello starts a renegotiation.
- TLS authorization extensions (RFC 5878: client_authz, server_authz) with SupplementalData (RFC 4680) carrying X.509 attribute certificates, TLS 1.2 (Config.Ext.AttributeCertificates, AcceptAttributeCertificates; ConnectionState().Ext.PeerAttributeCertificates).
- Pre-shared keys (x_psk.go; Config.Ext.PSK): the TLS 1.2 PSK, DHE_PSK and ECDHE_PSK key exchanges (RFC 4279, RFC 5489) with the suites of RFC 5487, 6655 (CCM, CCM_8), 7905 and 8442, a psk_identity_hint and a server lookup callback, no certificate needed; TLS 1.3 external PSKs (RFC 8446 4.2.11, "ext binder") with psk_dhe_ke and optionally psk_ke. ConnectionState().Ext.PSKIdentity. The legacy HMAC-SHA-1 CBC suites of RFC 4279 and RFC 5489 are there for old devices, also in TLS 1.0 and 1.1. With PSKConfig.Resumption, PSK sessions are resumed bound to their key: TLS 1.2 by ticket or session ID (x_psk_resume.go), TLS 1.3 external-PSK sessions by NewSessionTicket and the resumption PSK (x_psk_resume13.go; RFC 8446 2.2, 4.6.1), the ticket offered before the external identity.
- Raw public keys (x_rpk.go; RFC 7250; Config.Ext.RawPublicKeys) in TLS 1.2 and 1.3, both directions, trusted through a verify callback (pinning); ConnectionState().Ext.PeerRawPublicKey.
- Static Diffie-Hellman TLS_DH_RSA_WITH_AES_128_GCM_SHA256 (RFC 5288; IEC 62351-4), off by default: DH certificates (X9.42 or PKCS #3 keys of 2048 bits or more), Config.Ext.StaticDHCertificate, CreateStaticDHCertificate, GenerateStaticDHKey; an explicit client public value only (no fixed_dh).
Constant time ¶
Finite field Diffie-Hellman uses internal/bigmod (Go's constant-time modular arithmetic, pure Go path). The brainpool curves are our own code (internal/brainpool): scalar multiplication, ECDH and ECDSA signing are constant time in the secret; verification and encodings handle public data only. AES-CCM (internal/ccm) uses crypto/aes and constant-time tag comparison.
GODEBUG and SHA-1 ¶
The GODEBUG settings crypto/tls reads (tlssha1, tlsmlkem, tlssecpmlkem, tlsmaxrsasize) work as in crypto/tls: from the GODEBUG environment variable, else the build's defaults (go.mod go and godebug lines, //go:debug), else Go's defaults. They are read once, at first use; a later os.Setenv is not seen and runtime/metrics is not fed (GODEBUGValue and GODEBUGNonDefault report them instead). SHA-1 signatures in TLS 1.2, off by default since Go 1.25, are allowed by GODEBUG tlssha1=1 or, for one Config, by Config.Ext.AllowSHA1Signatures.
Not implemented ¶
FIPS 140-3 mode and 0-RTT.
Example (RawPublicKeys) ¶
Raw public keys (RFC 7250): the server presents a bare key, which the client trusts by pinning its SubjectPublicKeyInfo.
package main
import (
"bytes"
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"crypto/x509"
"errors"
"fmt"
"net"
"github.com/cB-Sigma/tlsx"
)
func main() {
serverKey, _ := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
pinned, _ := x509.MarshalPKIXPublicKey(serverKey.Public())
server := &tlsx.Config{MinVersion: tlsx.VersionTLS13,
Certificates: []tlsx.Certificate{tlsx.RawPublicKeyCertificate(serverKey)},
Ext: tlsx.ConfigExt{RawPublicKeys: &tlsx.RawPublicKeyConfig{Send: true, RawOnly: true}}}
client := &tlsx.Config{ServerName: "gateway.example", MinVersion: tlsx.VersionTLS13,
Ext: tlsx.ConfigExt{RawPublicKeys: &tlsx.RawPublicKeyConfig{RawOnly: true,
Verify: func(spki []byte) error {
if !bytes.Equal(spki, pinned) {
return errors.New("unknown server key")
}
return nil
}}}}
c, s := net.Pipe()
go tlsx.Server(s, server).Handshake()
conn := tlsx.Client(c, client)
if err := conn.Handshake(); err != nil {
fmt.Println(err)
return
}
fmt.Println("server key pinned:", bytes.Equal(conn.ConnectionState().Ext.PeerRawPublicKey, pinned))
}
Output: server key pinned: true
Index ¶
- Constants
- Variables
- func AppendCertsFromPEM(pool *x509.CertPool, pemCerts []byte) bool
- func CipherSuiteName(id uint16) string
- func CreateCertificate(rand io.Reader, template, parent *x509.Certificate, pub crypto.PublicKey, ...) ([]byte, error)
- func CreateStaticDHCertificate(rand io.Reader, template, parent *x509.Certificate, pub *DHPublicKey, ...) ([]byte, error)
- func GODEBUGNonDefault(name string) uint64
- func GODEBUGValue(name string) string
- func GenerateBrainpoolKey(id CurveID, rand io.Reader) (crypto.Signer, error)
- func IsIntegrityOnly(id uint16) bool
- func IsPSKSuite(id uint16) bool
- func IsRSAPSSKey(cert *x509.Certificate) bool
- func Listen(network, laddr string, config *Config) (net.Listener, error)
- func MarshalPKCS8PrivateKey(k crypto.PrivateKey) ([]byte, error)
- func MarshalStaticDHKey(k *DHPrivateKey) ([]byte, error)
- func NewListener(inner net.Listener, config *Config) net.Listener
- func ParseCertificate(der []byte) (*x509.Certificate, error)
- func TrustedAuthoritiesMatch(chain [][]byte, list []TrustedAuthority) bool
- func VersionName(version uint16) string
- type AlertError
- type Certificate
- type CertificateRequestInfo
- type CertificateVerificationError
- type CipherSuite
- type ClientAuthType
- type ClientHelloInfo
- type ClientSessionCache
- type ClientSessionState
- type Config
- func (c *Config) BuildNameToCertificate()deprecated
- func (c *Config) Clone() *Config
- func (c *Config) DecryptTicket(identity []byte, cs ConnectionState) (*SessionState, error)
- func (c *Config) EncryptTicket(cs ConnectionState, ss *SessionState) ([]byte, error)
- func (c *Config) SetSessionTicketKeys(keys [][32]byte)
- type ConfigExt
- type Conn
- func (c *Conn) Close() error
- func (c *Conn) CloseWrite() error
- func (c *Conn) ConnectionState() ConnectionState
- func (c *Conn) Handshake() error
- func (c *Conn) HandshakeContext(ctx context.Context) error
- func (c *Conn) LocalAddr() net.Addr
- func (c *Conn) NetConn() net.Conn
- func (c *Conn) OCSPResponse() []byte
- func (c *Conn) Read(b []byte) (int, error)
- func (c *Conn) RemoteAddr() net.Addr
- func (c *Conn) Renegotiate() error
- func (c *Conn) RenegotiateContext(ctx context.Context, resume bool) (err error)
- func (c *Conn) RequestRenegotiation() error
- func (c *Conn) Resume() error
- func (c *Conn) SendKeyUpdate(requestPeerUpdate bool) error
- func (c *Conn) SetDeadline(t time.Time) error
- func (c *Conn) SetReadDeadline(t time.Time) error
- func (c *Conn) SetWriteDeadline(t time.Time) error
- func (c *Conn) VerifyHostname(host string) error
- func (c *Conn) Write(b []byte) (int, error)
- type ConnectionState
- type CurveID
- type DHPrivateKey
- type DHPublicKey
- type Dialer
- type ECHRejectionError
- type EncryptedClientHelloKey
- type Event
- type EventKind
- type HelloExt
- type PSKConfig
- type QUICConfig
- type QUICConn
- func (q *QUICConn) Close() error
- func (q *QUICConn) ConnectionState() ConnectionState
- func (q *QUICConn) HandleData(level QUICEncryptionLevel, data []byte) error
- func (q *QUICConn) NextEvent() QUICEvent
- func (q *QUICConn) SendSessionTicket(opts QUICSessionTicketOptions) error
- func (q *QUICConn) SetTransportParameters(params []byte)
- func (q *QUICConn) Start(ctx context.Context) error
- func (q *QUICConn) StoreSession(session *SessionState) error
- type QUICEncryptionLevel
- type QUICEvent
- type QUICEventKind
- type QUICSessionTicketOptions
- type RawPublicKeyConfig
- type RecordHeaderError
- type RenegotiationSupport
- type ServerSessionCache
- type SessionState
- type SignatureScheme
- type StateExt
- type TrustedAuthority
- Bugs
Examples ¶
Constants ¶
const ( // TLS 1.0 - 1.2 cipher suites. TLS_RSA_WITH_RC4_128_SHA uint16 = 0x0005 TLS_RSA_WITH_3DES_EDE_CBC_SHA uint16 = 0x000a TLS_RSA_WITH_AES_128_CBC_SHA uint16 = 0x002f TLS_RSA_WITH_AES_256_CBC_SHA uint16 = 0x0035 TLS_RSA_WITH_AES_128_CBC_SHA256 uint16 = 0x003c TLS_RSA_WITH_AES_128_GCM_SHA256 uint16 = 0x009c TLS_RSA_WITH_AES_256_GCM_SHA384 uint16 = 0x009d TLS_ECDHE_ECDSA_WITH_RC4_128_SHA uint16 = 0xc007 TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA uint16 = 0xc009 TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA uint16 = 0xc00a TLS_ECDHE_RSA_WITH_RC4_128_SHA uint16 = 0xc011 TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA uint16 = 0xc012 TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA uint16 = 0xc013 TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA uint16 = 0xc014 TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 uint16 = 0xc023 TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 uint16 = 0xc027 TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 uint16 = 0xc02f TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 uint16 = 0xc02b TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 uint16 = 0xc030 TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 uint16 = 0xc02c TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 uint16 = 0xcca8 TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 uint16 = 0xcca9 // TLS 1.3 cipher suites. TLS_AES_128_GCM_SHA256 uint16 = 0x1301 TLS_AES_256_GCM_SHA384 uint16 = 0x1302 TLS_CHACHA20_POLY1305_SHA256 uint16 = 0x1303 // TLS_FALLBACK_SCSV isn't a standard cipher suite but an indicator // that the client is doing version fallback. See RFC 7507. TLS_FALLBACK_SCSV uint16 = 0x5600 // Legacy names for the corresponding cipher suites with the correct _SHA256 // suffix, retained for backward compatibility. TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 = TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 = TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 )
A list of cipher suite IDs that are, or have been, implemented by this package.
const ( VersionTLS10 = 0x0301 VersionTLS11 = 0x0302 VersionTLS12 = 0x0303 VersionTLS13 = 0x0304 // Deprecated: SSLv3 is cryptographically broken, and is no longer // supported by this package. See golang.org/issue/32716. VersionSSL30 = 0x0300 )
const ( QUICEncryptionLevelInitial = QUICEncryptionLevel(iota) QUICEncryptionLevelEarly QUICEncryptionLevelHandshake QUICEncryptionLevelApplication )
const ( TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 uint16 = 0x009e // RFC 5288 TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 uint16 = 0x009f // RFC 5288 TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 uint16 = 0xc024 // RFC 5289 TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 uint16 = 0xc028 // RFC 5289 TLS_AES_128_CCM_SHA256 uint16 = 0x1304 // RFC 8446 B.4 TLS_AES_128_CCM_8_SHA256 uint16 = 0x1305 // RFC 8446 B.4 // Integrity-only TLS 1.3 suites (RFC 9150): no confidentiality. TLS_SHA256_SHA256 uint16 = 0xc0b4 TLS_SHA384_SHA384 uint16 = 0xc0b5 // TLS 1.2 integrity-only suite (RFC 5246 A.5): RSA key transport, no // encryption, HMAC-SHA256. TLS_RSA_WITH_NULL_SHA256 uint16 = 0x003b )
Cipher suites tlsx adds.
const ( TrustedPreAgreed uint8 = 0 TrustedKeySHA1Hash uint8 = 1 TrustedX509Name uint8 = 2 TrustedCertSHA1Hash uint8 = 3 )
Trusted authority identifier types (RFC 6066 6).
const ( TLS_PSK_WITH_AES_128_CBC_SHA256 uint16 = 0x00ae // RFC 5487 TLS_PSK_WITH_AES_256_CBC_SHA384 uint16 = 0x00af // RFC 5487 TLS_PSK_WITH_AES_128_GCM_SHA256 uint16 = 0x00a8 // RFC 5487 TLS_PSK_WITH_AES_256_GCM_SHA384 uint16 = 0x00a9 // RFC 5487 TLS_PSK_WITH_AES_128_CCM uint16 = 0xc0a4 // RFC 6655 TLS_PSK_WITH_AES_256_CCM uint16 = 0xc0a5 // RFC 6655 TLS_PSK_WITH_AES_128_CCM_8 uint16 = 0xc0a8 // RFC 6655 TLS_PSK_WITH_AES_256_CCM_8 uint16 = 0xc0a9 // RFC 6655 TLS_PSK_WITH_CHACHA20_POLY1305_SHA256 uint16 = 0xccab // RFC 7905 TLS_DHE_PSK_WITH_AES_128_CBC_SHA256 uint16 = 0x00b2 // RFC 5487 TLS_DHE_PSK_WITH_AES_256_CBC_SHA384 uint16 = 0x00b3 // RFC 5487 TLS_DHE_PSK_WITH_AES_128_GCM_SHA256 uint16 = 0x00aa // RFC 5487 TLS_DHE_PSK_WITH_AES_256_GCM_SHA384 uint16 = 0x00ab // RFC 5487 TLS_DHE_PSK_WITH_AES_128_CCM uint16 = 0xc0a6 // RFC 6655 TLS_DHE_PSK_WITH_AES_256_CCM uint16 = 0xc0a7 // RFC 6655 TLS_DHE_PSK_WITH_CHACHA20_POLY1305_SHA256 uint16 = 0xccad // RFC 7905 TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256 uint16 = 0xc037 // RFC 5489 TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384 uint16 = 0xc038 // RFC 5489 TLS_ECDHE_PSK_WITH_AES_128_GCM_SHA256 uint16 = 0xd001 // RFC 8442 TLS_ECDHE_PSK_WITH_AES_256_GCM_SHA384 uint16 = 0xd002 // RFC 8442 TLS_ECDHE_PSK_WITH_AES_128_CCM_8_SHA256 uint16 = 0xd003 // RFC 8442 TLS_ECDHE_PSK_WITH_AES_128_CCM_SHA256 uint16 = 0xd005 // RFC 8442 TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256 uint16 = 0xccac // RFC 7905 // Legacy suites with HMAC-SHA-1, for old devices: CBC only (MAC then // encrypt, or encrypt_then_mac when negotiated), usable from TLS 1.0. TLS_PSK_WITH_AES_128_CBC_SHA uint16 = 0x008c // RFC 4279 TLS_PSK_WITH_AES_256_CBC_SHA uint16 = 0x008d // RFC 4279 TLS_DHE_PSK_WITH_AES_128_CBC_SHA uint16 = 0x0090 // RFC 4279 TLS_DHE_PSK_WITH_AES_256_CBC_SHA uint16 = 0x0091 // RFC 4279 TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA uint16 = 0xc035 // RFC 5489 TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA uint16 = 0xc036 // RFC 5489 )
TLS 1.2 PSK cipher suites tlsx adds.
const ( CertificateTypeX509 uint8 = 0 CertificateTypeRawPublicKey uint8 = 2 )
Extension and certificate type numbers of RFC 7250.
const ( // AuthzX509AttrCert is the x509_attr_cert authorization data format. AuthzX509AttrCert uint8 = 0 )
const TLS_DH_RSA_WITH_AES_128_GCM_SHA256 uint16 = 0x00a0
TLS_DH_RSA_WITH_AES_128_GCM_SHA256 is the static DH suite (RFC 5288).
Variables ¶
var ( // ErrInsecureRenegotiation: the peer did not signal secure // renegotiation (RFC 5746) or sent wrong verify data. ErrInsecureRenegotiation = errors.New("tlsx: peer does not support secure renegotiation (RFC 5746)") // ErrRenegotiationNotAllowed: renegotiation is not enabled. ErrRenegotiationNotAllowed = errors.New("tlsx: renegotiation not allowed by the configuration") // ErrRenegotiationVersionChange: the renegotiation asked for another // TLS version than the connection's. ErrRenegotiationVersionChange = errors.New("tlsx: renegotiation changes the TLS version") // ErrNotTLS12 and ErrNotTLS13 report a post-handshake operation for // the other version. ErrNotTLS12 = errors.New("tlsx: operation needs a TLS 1.2 connection") ErrNotTLS13 = errors.New("tlsx: operation needs a TLS 1.3 connection") )
Renegotiation errors.
var ErrRenegotiationRefusedByPeer = errors.New("tlsx: the server refused the renegotiation")
ErrRenegotiationRefusedByPeer: the server answered no_renegotiation.
var ErrUnknownPSKIdentity = errors.New("tlsx: unknown PSK identity")
ErrUnknownPSKIdentity is a server's error for an identity Lookup does not know (the client is sent unknown_psk_identity).
Functions ¶
func AppendCertsFromPEM ¶
AppendCertsFromPEM adds the PEM certificates to pool like x509.CertPool.AppendCertsFromPEM, parsing them with ParseCertificate (so RSASSA-PSS and brainpool CA keys work).
func CipherSuiteName ¶
CipherSuiteName returns the standard name for the passed cipher suite ID (e.g. "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256"), or a fallback representation of the ID value if the cipher suite is not implemented by this package.
func CreateCertificate ¶
func CreateCertificate(rand io.Reader, template, parent *x509.Certificate, pub crypto.PublicKey, priv crypto.Signer) ([]byte, error)
CreateCertificate is x509.CreateCertificate that also takes brainpool public and signing keys.
func CreateStaticDHCertificate ¶
func CreateStaticDHCertificate(rand io.Reader, template, parent *x509.Certificate, pub *DHPublicKey, signer crypto.Signer) ([]byte, error)
CreateStaticDHCertificate issues a certificate for a DH public key (the Go x509 package cannot): template and parent as for x509.CreateCertificate, signed by signer (RSA or ECDSA, SHA-256 or SHA-384).
func GODEBUGNonDefault ¶
GODEBUGNonDefault returns how many times tlsx used the non-default behaviour of the GODEBUG setting name in this process: what Go counts in runtime/metrics as /godebug/non-default-behavior/<name>:events. For tlssha1 it counts SHA-1 signatures in TLS 1.2 handshakes, whether GODEBUG or Config.Ext.AllowSHA1Signatures allowed them.
func GODEBUGValue ¶
GODEBUGValue returns the value tlsx uses for the GODEBUG setting name ("" means Go's default behaviour). The settings crypto/tls reads, and so tlsx, are tlssha1, tlsmlkem, tlssecpmlkem, tlsmaxrsasize and fips140ems (the last only matters in FIPS 140-3 mode, which tlsx does not have).
func GenerateBrainpoolKey ¶
GenerateBrainpoolKey makes an ECDSA key on the brainpool curve of id (BrainpoolP256r1, P384r1 or P512r1, either code point), for tests and tooling. Its Sign is constant time in the key (internal/brainpool).
func IsIntegrityOnly ¶
IsIntegrityOnly reports a cipher suite without confidentiality (RFC 9150).
func IsPSKSuite ¶
IsPSKSuite reports a TLS 1.2 pre-shared key cipher suite.
func IsRSAPSSKey ¶
func IsRSAPSSKey(cert *x509.Certificate) bool
IsRSAPSSKey reports whether cert (parsed by ParseCertificate) has an RSASSA-PSS public key.
func Listen ¶
Listen creates a TLS listener accepting connections on the given network address using net.Listen. The configuration config must be non-nil and must include at least one certificate or else set GetCertificate.
func MarshalPKCS8PrivateKey ¶
func MarshalPKCS8PrivateKey(k crypto.PrivateKey) ([]byte, error)
MarshalPKCS8PrivateKey is x509.MarshalPKCS8PrivateKey that also takes brainpool keys.
func MarshalStaticDHKey ¶
func MarshalStaticDHKey(k *DHPrivateKey) ([]byte, error)
MarshalStaticDHKey encodes the key as PKCS #8 (X9.42 dhpublicnumber), the "PRIVATE KEY" form OpenSSL writes for DH keys.
func NewListener ¶
NewListener creates a Listener which accepts connections from an inner Listener and wraps each connection with Server. The configuration config must be non-nil and must include at least one certificate or else set GetCertificate.
func ParseCertificate ¶
func ParseCertificate(der []byte) (*x509.Certificate, error)
ParseCertificate parses a DER certificate like x509.ParseCertificate and also accepts RSASSA-PSS and brainpool public keys.
func TrustedAuthoritiesMatch ¶
func TrustedAuthoritiesMatch(chain [][]byte, list []TrustedAuthority) bool
TrustedAuthoritiesMatch reports whether the certificate chain (DER, leaf first) chains to an authority of the list: a pre_agreed entry, the SHA-1 of a chain certificate, the name of an issuer in the chain, or the key hash of a chain CA or of an issuer named by an authority key identifier.
func VersionName ¶
VersionName returns the name for the provided TLS version number (e.g. "TLS 1.3"), or a fallback representation of the value if the version is not implemented by this package.
Types ¶
type AlertError ¶
type AlertError uint8
An AlertError is a TLS alert.
When using a QUIC transport, QUICConn methods will return an error which wraps AlertError rather than sending a TLS alert.
func (AlertError) Error ¶
func (e AlertError) Error() string
type Certificate ¶
type Certificate struct {
Certificate [][]byte
// PrivateKey contains the private key corresponding to the public key in
// Leaf. This must implement [crypto.Signer] with an RSA, ECDSA, Ed25519
// (TLS 1.2+), or ML-DSA (TLS 1.3) PublicKey.
//
// For a server up to TLS 1.2, it can also implement crypto.Decrypter with
// an RSA PublicKey.
//
// If it implements [crypto.MessageSigner], SignMessage will be used instead
// of Sign for TLS 1.2 and later.
PrivateKey crypto.PrivateKey
// SupportedSignatureAlgorithms is an optional list restricting what
// signature algorithms the PrivateKey can be used for.
SupportedSignatureAlgorithms []SignatureScheme
// OCSPStaple contains an optional OCSP response which will be served
// to clients that request it.
OCSPStaple []byte
// SignedCertificateTimestamps contains an optional list of Signed
// Certificate Timestamps which will be served to clients that request it.
SignedCertificateTimestamps [][]byte
// ChainOCSPStaples (tlsx) are OCSP responses for Certificate[1:], index
// i for Certificate[i+1] (nil for none): sent per certificate entry in
// TLS 1.3 and in an ocsp_multi CertificateStatus (RFC 6961) in TLS 1.2.
ChainOCSPStaples [][]byte
// Leaf is the parsed form of the leaf certificate, which may be initialized
// using x509.ParseCertificate to reduce per-handshake processing. If nil,
// the leaf certificate will be parsed as needed.
Leaf *x509.Certificate
}
A Certificate is a chain of one or more certificates, leaf first.
func LoadX509KeyPair ¶
func LoadX509KeyPair(certFile, keyFile string) (Certificate, error)
LoadX509KeyPair reads and parses a public/private key pair from a pair of files. The files must contain PEM encoded data. The certificate file may contain intermediate certificates following the leaf certificate to form a certificate chain. On successful return, Certificate.Leaf will be populated.
func RawPublicKeyCertificate ¶
func RawPublicKeyCertificate(key crypto.Signer) Certificate
RawPublicKeyCertificate is a Certificate for authenticating with key as a raw public key only (RawPublicKeyConfig.Send, no X.509 chain).
func X509KeyPair ¶
func X509KeyPair(certPEMBlock, keyPEMBlock []byte) (Certificate, error)
X509KeyPair parses a public/private key pair from a pair of PEM encoded data. On successful return, Certificate.Leaf will be populated.
type CertificateRequestInfo ¶
type CertificateRequestInfo struct {
// AcceptableCAs contains zero or more, DER-encoded, X.501
// Distinguished Names. These are the names of root or intermediate CAs
// that the server wishes the returned certificate to be signed by. An
// empty slice indicates that the server has no preference.
AcceptableCAs [][]byte
// SignatureSchemes lists the signature schemes that the server is
// willing to verify.
SignatureSchemes []SignatureScheme
// Version is the TLS version that was negotiated for this connection.
Version uint16
// contains filtered or unexported fields
}
CertificateRequestInfo contains information from a server's CertificateRequest message, which is used to demand a certificate and proof of control from a client.
func (*CertificateRequestInfo) Context ¶
func (c *CertificateRequestInfo) Context() context.Context
Context returns the context of the handshake that is in progress. This context is a child of the context passed to HandshakeContext, if any, and is canceled when the handshake concludes.
func (*CertificateRequestInfo) SupportsCertificate ¶
func (cri *CertificateRequestInfo) SupportsCertificate(c *Certificate) error
SupportsCertificate returns nil if the provided certificate is supported by the server that sent the CertificateRequest. Otherwise, it returns an error describing the reason for the incompatibility.
type CertificateVerificationError ¶
type CertificateVerificationError struct {
// UnverifiedCertificates and its contents should not be modified.
UnverifiedCertificates []*x509.Certificate
Err error
}
CertificateVerificationError is returned when certificate verification fails during the handshake.
func (*CertificateVerificationError) Error ¶
func (e *CertificateVerificationError) Error() string
func (*CertificateVerificationError) Unwrap ¶
func (e *CertificateVerificationError) Unwrap() error
type CipherSuite ¶
type CipherSuite struct {
ID uint16
Name string
// Supported versions is the list of TLS protocol versions that can
// negotiate this cipher suite.
SupportedVersions []uint16
// Insecure is true if the cipher suite has known security issues
// due to its primitives, design, or implementation.
Insecure bool
}
CipherSuite is a TLS cipher suite. Note that most functions in this package accept and expose cipher suite IDs instead of this type.
func CipherSuites ¶
func CipherSuites() []*CipherSuite
CipherSuites returns a list of cipher suites currently implemented by this package, excluding those with security issues, which are returned by InsecureCipherSuites.
The list is sorted by ID. Note that the default cipher suites selected by this package might depend on logic that can't be captured by a static list, and might not match those returned by this function.
func InsecureCipherSuites ¶
func InsecureCipherSuites() []*CipherSuite
InsecureCipherSuites returns a list of cipher suites currently implemented by this package and which have security issues.
Most applications should not use the cipher suites in this list, and should only use those returned by CipherSuites.
type ClientAuthType ¶
type ClientAuthType int
ClientAuthType declares the policy the server will follow for TLS Client Authentication.
const ( // NoClientCert indicates that no client certificate should be requested // during the handshake, and if any certificates are sent they will not // be verified. NoClientCert ClientAuthType = iota // RequestClientCert indicates that a client certificate should be requested // during the handshake, but does not require that the client send any // certificates. RequestClientCert // RequireAnyClientCert indicates that a client certificate should be requested // during the handshake, and that at least one certificate is required to be // sent by the client, but that certificate is not required to be valid. RequireAnyClientCert // VerifyClientCertIfGiven indicates that a client certificate should be requested // during the handshake, but does not require that the client sends a // certificate. If the client does send a certificate it is required to be // valid. VerifyClientCertIfGiven // RequireAndVerifyClientCert indicates that a client certificate should be requested // during the handshake, and that at least one valid certificate is required // to be sent by the client. RequireAndVerifyClientCert )
func (ClientAuthType) String ¶
func (i ClientAuthType) String() string
type ClientHelloInfo ¶
type ClientHelloInfo struct {
// CipherSuites lists the CipherSuites supported by the client (e.g.
// TLS_AES_128_GCM_SHA256, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256).
CipherSuites []uint16
// ServerName indicates the name of the server requested by the client
// in order to support virtual hosting. ServerName is only set if the
// client is using SNI (see RFC 4366, Section 3.1).
ServerName string
// SupportedCurves lists the key exchange mechanisms supported by the
// client. It was renamed to "supported groups" in TLS 1.3, see RFC 8446,
// Section 4.2.7 and [CurveID].
//
// SupportedCurves may be nil in TLS 1.2 and lower if the Supported Elliptic
// Curves Extension is not being used (see RFC 4492, Section 5.1.1).
SupportedCurves []CurveID
// SupportedPoints lists the point formats supported by the client.
// SupportedPoints is set only if the Supported Point Formats Extension
// is being used (see RFC 4492, Section 5.1.2).
SupportedPoints []uint8
// SignatureSchemes lists the signature and hash schemes that the client
// is willing to verify. SignatureSchemes is set only if the Signature
// Algorithms Extension is being used (see RFC 5246, Section 7.4.1.4.1).
SignatureSchemes []SignatureScheme
// SupportedProtos lists the application protocols supported by the client.
// SupportedProtos is set only if the Application-Layer Protocol
// Negotiation Extension is being used (see RFC 7301, Section 3.1).
//
// Servers can select a protocol by setting Config.NextProtos in a
// GetConfigForClient return value.
SupportedProtos []string
// SupportedVersions lists the TLS versions supported by the client.
// For TLS versions less than 1.3, this is extrapolated from the max
// version advertised by the client, so values other than the greatest
// might be rejected if used.
SupportedVersions []uint16
// Extensions lists the IDs of the extensions presented by the client
// in the ClientHello.
Extensions []uint16
// Conn is the underlying net.Conn for the connection. Do not read
// from, or write to, this connection; that will cause the TLS
// connection to fail.
Conn net.Conn
// HelloRetryRequest indicates whether the ClientHello was sent in response
// to a HelloRetryRequest message.
HelloRetryRequest bool
// Ext is what tlsx adds from the ClientHello (x_config.go).
Ext HelloExt
// contains filtered or unexported fields
}
ClientHelloInfo contains information from a ClientHello message in order to guide application logic in the GetCertificate and GetConfigForClient callbacks.
func (*ClientHelloInfo) Context ¶
func (c *ClientHelloInfo) Context() context.Context
Context returns the context of the handshake that is in progress. This context is a child of the context passed to HandshakeContext, if any, and is canceled when the handshake concludes.
func (*ClientHelloInfo) SupportsCertificate ¶
func (chi *ClientHelloInfo) SupportsCertificate(c *Certificate) error
SupportsCertificate returns nil if the provided certificate is supported by the client that sent the ClientHello. Otherwise, it returns an error describing the reason for the incompatibility.
If this ClientHelloInfo was passed to a GetConfigForClient or GetCertificate callback, this method will take into account the associated Config. Note that if GetConfigForClient returns a different Config, the change can't be accounted for by this method.
This function will call x509.ParseCertificate unless c.Leaf is set, which can incur a significant performance cost.
type ClientSessionCache ¶
type ClientSessionCache interface {
// Get searches for a ClientSessionState associated with the given key.
// On return, ok is true if one was found.
Get(sessionKey string) (session *ClientSessionState, ok bool)
// Put adds the ClientSessionState to the cache with the given key. It might
// get called multiple times in a connection if a TLS 1.3 server provides
// more than one session ticket. If called with a nil *ClientSessionState,
// it should remove the cache entry.
Put(sessionKey string, cs *ClientSessionState)
}
ClientSessionCache is a cache of ClientSessionState objects that can be used by a client to resume a TLS session with a given server. ClientSessionCache implementations should expect to be called concurrently from different goroutines. Up to TLS 1.2, only ticket-based resumption is supported, not SessionID-based resumption. In TLS 1.3 they were merged into PSK modes, which are supported via this interface.
func NewLRUClientSessionCache ¶
func NewLRUClientSessionCache(capacity int) ClientSessionCache
NewLRUClientSessionCache returns a ClientSessionCache with the given capacity that uses an LRU strategy. If capacity is < 1, a default capacity is used instead.
type ClientSessionState ¶
type ClientSessionState struct {
// contains filtered or unexported fields
}
ClientSessionState contains the state needed by a client to resume a previous TLS session.
func NewResumptionState ¶
func NewResumptionState(ticket []byte, state *SessionState) (*ClientSessionState, error)
NewResumptionState returns a state value that can be returned by ClientSessionCache.Get to resume a previous session.
state needs to be returned by ParseSessionState, and the ticket and session state must have been returned by ClientSessionState.ResumptionState.
func (*ClientSessionState) ResumptionState ¶
func (cs *ClientSessionState) ResumptionState() (ticket []byte, state *SessionState, err error)
ResumptionState returns the session ticket sent by the server (also known as the session's identity) and the state necessary to resume this session.
It can be called by ClientSessionCache.Put to serialize (with SessionState.Bytes) and store the session.
type Config ¶
type Config struct {
// Rand provides the source of entropy for the connection.
// If Rand is nil, TLS uses the cryptographic random reader in package
// crypto/rand. The Reader must be safe for use by multiple goroutines.
//
// Deprecated: this should be left nil in production. Not all TLS
// configurations are guaranteed to use Rand. Test code can use
// [testing/cryptotest.SetGlobalRandom] instead.
Rand io.Reader
// Time returns the current time as the number of seconds since the epoch.
// If Time is nil, TLS uses time.Now.
Time func() time.Time
// Certificates contains one or more certificate chains to present to the
// other side of the connection. The first certificate compatible with the
// peer's requirements is selected automatically.
//
// Server configurations must set one of Certificates, GetCertificate or
// GetConfigForClient. Clients doing client-authentication may set either
// Certificates or GetClientCertificate.
//
// Note: if there are multiple Certificates, and they don't have the
// optional field Leaf set, certificate selection will incur a significant
// per-handshake performance cost.
Certificates []Certificate
// NameToCertificate maps from a certificate name to an element of
// Certificates. Note that a certificate name can be of the form
// '*.example.com' and so doesn't have to be a domain name as such.
//
// Deprecated: NameToCertificate only allows associating a single
// certificate with a given name. Leave this field nil to let the library
// select the first compatible chain from Certificates.
NameToCertificate map[string]*Certificate
// GetCertificate returns a Certificate based on the given
// ClientHelloInfo. It will only be called if the client supplies SNI
// information or if Certificates is empty.
//
// If GetCertificate is nil or returns nil, then the certificate is
// retrieved from NameToCertificate. If NameToCertificate is nil, the
// best element of Certificates will be used.
//
// Once a Certificate is returned it should not be modified.
GetCertificate func(*ClientHelloInfo) (*Certificate, error)
// GetClientCertificate, if not nil, is called when a server requests a
// certificate from a client. If set, the contents of Certificates will
// be ignored.
//
// If GetClientCertificate returns an error, the handshake will be
// aborted and that error will be returned. Otherwise
// GetClientCertificate must return a non-nil Certificate. If
// Certificate.Certificate is empty then no certificate will be sent to
// the server. If this is unacceptable to the server then it may abort
// the handshake.
//
// GetClientCertificate may be called multiple times for the same
// connection if renegotiation occurs or if TLS 1.3 is in use.
//
// Once a Certificate is returned it should not be modified.
GetClientCertificate func(*CertificateRequestInfo) (*Certificate, error)
// GetConfigForClient, if not nil, is called after a ClientHello is
// received from a client. It may return a non-nil Config in order to
// change the Config that will be used to handle this connection. If
// the returned Config is nil, the original Config will be used. The
// Config returned by this callback may not be subsequently modified.
//
// If GetConfigForClient is nil, the Config passed to Server() will be
// used for all connections.
//
// If SessionTicketKey is explicitly set on the returned Config, or if
// SetSessionTicketKeys is called on the returned Config, those keys will
// be used. Otherwise, the original Config keys will be used (and possibly
// rotated if they are automatically managed). WARNING: this allows session
// resumption of connections originally established with the parent (or a
// sibling) Config, which may bypass the [Config.VerifyPeerCertificate]
// value of the returned Config.
GetConfigForClient func(*ClientHelloInfo) (*Config, error)
// VerifyPeerCertificate, if not nil, is called after normal
// certificate verification by either a TLS client or server. It
// receives the raw ASN.1 certificates provided by the peer and also
// any verified chains that normal processing found. If it returns a
// non-nil error, the handshake is aborted and that error results.
//
// If normal verification fails then the handshake will abort before
// considering this callback. If normal verification is disabled (on the
// client when InsecureSkipVerify is set, or on a server when ClientAuth is
// RequestClientCert or RequireAnyClientCert), then this callback will be
// considered but the verifiedChains argument will always be nil. When
// ClientAuth is NoClientCert, this callback is not called on the server.
// rawCerts may be empty on the server if ClientAuth is RequestClientCert or
// VerifyClientCertIfGiven.
//
// This callback is not invoked on resumed connections. WARNING: this
// includes connections resumed across Configs returned by [Config.Clone] or
// [Config.GetConfigForClient] and their parents. If that is not intended,
// use [Config.VerifyConnection] instead, or set [Config.SessionTicketsDisabled].
//
// verifiedChains and its contents should not be modified.
VerifyPeerCertificate func(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error
// VerifyConnection, if not nil, is called after normal certificate
// verification and after VerifyPeerCertificate by either a TLS client
// or server. If it returns a non-nil error, the handshake is aborted
// and that error results.
//
// If normal verification fails then the handshake will abort before
// considering this callback. This callback will run for all connections,
// including resumptions, regardless of InsecureSkipVerify or ClientAuth
// settings.
VerifyConnection func(ConnectionState) error
// RootCAs defines the set of root certificate authorities
// that clients use when verifying server certificates.
// If RootCAs is nil, TLS uses the host's root CA set.
RootCAs *x509.CertPool
// NextProtos is a list of supported application level protocols, in
// order of preference. If both peers support ALPN, the selected
// protocol will be one from this list, and the connection will fail
// if there is no mutually supported protocol. If NextProtos is empty
// or the peer doesn't support ALPN, the connection will succeed and
// ConnectionState.NegotiatedProtocol will be empty.
NextProtos []string
// ServerName is used to verify the hostname on the returned
// certificates unless InsecureSkipVerify is given. It is also included
// in the client's handshake to support virtual hosting unless it is
// an IP address.
ServerName string
// ClientAuth determines the server's policy for
// TLS Client Authentication. The default is NoClientCert.
ClientAuth ClientAuthType
// ClientCAs defines the set of root certificate authorities
// that servers use if required to verify a client certificate
// by the policy in ClientAuth.
ClientCAs *x509.CertPool
// InsecureSkipVerify controls whether a client verifies the server's
// certificate chain and host name. If InsecureSkipVerify is true, crypto/tls
// accepts any certificate presented by the server and any host name in that
// certificate. In this mode, TLS is susceptible to machine-in-the-middle
// attacks unless custom verification is used. This should be used only for
// testing or in combination with VerifyConnection or VerifyPeerCertificate.
InsecureSkipVerify bool
// CipherSuites is a list of enabled TLS 1.0–1.2 cipher suites. The order of
// the list is ignored. Note that TLS 1.3 ciphersuites are not configurable.
//
// If CipherSuites is nil, a safe default list is used. The default cipher
// suites might change over time.
CipherSuites []uint16
// PreferServerCipherSuites is a legacy field and has no effect.
//
// It used to control whether the server would follow the client's or the
// server's preference. Servers now select the best mutually supported
// cipher suite based on logic that takes into account inferred client
// hardware, server hardware, and security.
//
// Deprecated: PreferServerCipherSuites is ignored.
PreferServerCipherSuites bool
// SessionTicketsDisabled may be set to true to disable session ticket and
// PSK (resumption) support. Note that on clients, session ticket support is
// also disabled if ClientSessionCache is nil.
SessionTicketsDisabled bool
// SessionTicketKey is used by TLS servers to provide session resumption.
// See RFC 5077 and the PSK mode of RFC 8446. If zero, it will be filled
// with random data before the first server handshake.
//
// Deprecated: if this field is left at zero, session ticket keys will be
// automatically rotated every day and dropped after seven days. For
// customizing the rotation schedule or synchronizing servers that are
// terminating connections for the same host, use SetSessionTicketKeys.
SessionTicketKey [32]byte
// ClientSessionCache is a cache of ClientSessionState entries for TLS
// session resumption. It is only used by clients.
ClientSessionCache ClientSessionCache
// UnwrapSession is called on the server to turn a ticket/identity
// previously produced by [WrapSession] into a usable session.
//
// UnwrapSession will usually either decrypt a session state in the ticket
// (for example with [Config.EncryptTicket]), or use the ticket as a handle
// to recover a previously stored state. It must use [ParseSessionState] to
// deserialize the session state.
//
// If UnwrapSession returns an error, the connection is terminated. If it
// returns (nil, nil), the session is ignored. crypto/tls may still choose
// not to resume the returned session.
UnwrapSession func(identity []byte, cs ConnectionState) (*SessionState, error)
// WrapSession is called on the server to produce a session ticket/identity.
//
// WrapSession must serialize the session state with [SessionState.Bytes].
// It may then encrypt the serialized state (for example with
// [Config.DecryptTicket]) and use it as the ticket, or store the state and
// return a handle for it.
//
// If WrapSession returns an error, the connection is terminated.
//
// Warning: the return value will be exposed on the wire and to clients in
// plaintext. The application is in charge of encrypting and authenticating
// it (and rotating keys) or returning high-entropy identifiers. Failing to
// do so correctly can compromise current, previous, and future connections
// depending on the protocol version.
WrapSession func(ConnectionState, *SessionState) ([]byte, error)
// MinVersion contains the minimum TLS version that is acceptable.
//
// By default, TLS 1.2 is currently used as the minimum. TLS 1.0 is the
// minimum supported by this package.
MinVersion uint16
// MaxVersion contains the maximum TLS version that is acceptable.
//
// By default, the maximum version supported by this package is used,
// which is currently TLS 1.3.
MaxVersion uint16
// CurvePreferences contains a set of supported key exchange mechanisms.
// The name refers to elliptic curves for legacy reasons, see [CurveID].
// The order of the list is ignored, and key exchange mechanisms are chosen
// from this list using an internal preference order. If empty, the default
// will be used.
//
// From Go 1.24, the default includes the [X25519MLKEM768] hybrid
// post-quantum key exchange. To disable it, set CurvePreferences explicitly
// or use the GODEBUG=tlsmlkem=0 environment variable.
//
// From Go 1.26, the default includes the [SecP256r1MLKEM768] and
// [SecP384r1MLKEM1024] hybrid post-quantum key exchanges, too. To disable
// them, set CurvePreferences explicitly or use either the
// GODEBUG=tlsmlkem=0 or the GODEBUG=tlssecpmlkem=0 environment variable.
CurvePreferences []CurveID
// DynamicRecordSizingDisabled disables adaptive sizing of TLS records.
// When true, the largest possible TLS record size is always used. When
// false, the size of TLS records may be adjusted in an attempt to
// improve latency.
DynamicRecordSizingDisabled bool
// Renegotiation controls what types of renegotiation are supported.
// The default, none, is correct for the vast majority of applications.
Renegotiation RenegotiationSupport
// KeyLogWriter optionally specifies a destination for TLS master secrets
// in NSS key log format that can be used to allow external programs
// such as Wireshark to decrypt TLS connections.
// See https://datatracker.ietf.org/doc/draft-ietf-tls-keylogfile/.
// Use of KeyLogWriter compromises security and should only be
// used for debugging.
KeyLogWriter io.Writer
// EncryptedClientHelloConfigList is a serialized ECHConfigList. If
// provided, clients will attempt to connect to servers using Encrypted
// Client Hello (ECH) using one of the provided ECHConfigs.
//
// Servers do not use this field. In order to configure ECH for servers, see
// the EncryptedClientHelloKeys field.
//
// If the list contains no valid ECH configs, the handshake will fail
// and return an error.
//
// If EncryptedClientHelloConfigList is set, MinVersion, if set, must
// be VersionTLS13.
//
// When EncryptedClientHelloConfigList is set, the handshake will only
// succeed if ECH is successfully negotiated. If the server rejects ECH,
// an ECHRejectionError error will be returned, which may contain a new
// ECHConfigList that the server suggests using.
//
// How this field is parsed may change in future Go versions, if the
// encoding described in the final Encrypted Client Hello RFC changes.
EncryptedClientHelloConfigList []byte
// EncryptedClientHelloRejectionVerify, if not nil, is called when ECH is
// rejected by the remote server, in order to verify the ECH provider
// certificate in the outer ClientHello. If it returns a non-nil error, the
// handshake is aborted and that error results.
//
// On the server side this field is not used.
//
// Unlike VerifyPeerCertificate and VerifyConnection, normal certificate
// verification will not be performed before calling
// EncryptedClientHelloRejectionVerify.
//
// If EncryptedClientHelloRejectionVerify is nil and ECH is rejected, the
// roots in RootCAs will be used to verify the ECH providers public
// certificate. VerifyPeerCertificate and VerifyConnection are not called
// when ECH is rejected, even if set, and InsecureSkipVerify is ignored.
EncryptedClientHelloRejectionVerify func(ConnectionState) error
// GetEncryptedClientHelloKeys, if not nil, is called when by a server when
// a client attempts ECH.
//
// If GetEncryptedClientHelloKeys is not nil, [EncryptedClientHelloKeys] is
// ignored.
//
// If GetEncryptedClientHelloKeys returns an error, the handshake will be
// aborted and the error will be returned. Otherwise,
// GetEncryptedClientHelloKeys must return a non-nil slice of
// [EncryptedClientHelloKey] that represents the acceptable ECH keys.
//
// For further details, see [EncryptedClientHelloKeys].
GetEncryptedClientHelloKeys func(*ClientHelloInfo) ([]EncryptedClientHelloKey, error)
// EncryptedClientHelloKeys are the ECH keys to use when a client
// attempts ECH.
//
// If EncryptedClientHelloKeys is set, MinVersion, if set, must be
// VersionTLS13.
//
// If a client attempts ECH, but it is rejected by the server, the server
// will send a list of configs to retry based on the set of
// EncryptedClientHelloKeys which have the SendAsRetry field set.
//
// If GetEncryptedClientHelloKeys is non-nil, EncryptedClientHelloKeys is
// ignored.
//
// On the client side, this field is ignored. In order to configure ECH for
// clients, see the EncryptedClientHelloConfigList field.
EncryptedClientHelloKeys []EncryptedClientHelloKey
// Ext holds the tlsx settings (x_config.go).
Ext ConfigExt
// contains filtered or unexported fields
}
A Config structure is used to configure a TLS client or server. After one has been passed to a TLS function it must not be modified. A Config may be reused; the tls package will also not modify it.
func (*Config) BuildNameToCertificate
deprecated
func (c *Config) BuildNameToCertificate()
BuildNameToCertificate parses c.Certificates and builds c.NameToCertificate from the CommonName and SubjectAlternateName fields of each of the leaf certificates.
Deprecated: NameToCertificate only allows associating a single certificate with a given name. Leave that field nil to let the library select the first compatible chain from Certificates.
func (*Config) Clone ¶
Clone returns a shallow clone of c or nil if c is nil. It is safe to clone a Config that is being used concurrently by a TLS client or server.
The returned Config can share session ticket keys with the original Config, which means connections could be resumed across the two Configs. WARNING: Config.VerifyPeerCertificate does not get called on resumed connections, including connections that were originally established on the parent Config. If that is not intended, use Config.VerifyConnection instead, or set Config.SessionTicketsDisabled.
func (*Config) DecryptTicket ¶
func (c *Config) DecryptTicket(identity []byte, cs ConnectionState) (*SessionState, error)
DecryptTicket decrypts a ticket encrypted by Config.EncryptTicket. It can be used as a Config.UnwrapSession implementation.
If the ticket can't be decrypted or parsed, DecryptTicket returns (nil, nil).
func (*Config) EncryptTicket ¶
func (c *Config) EncryptTicket(cs ConnectionState, ss *SessionState) ([]byte, error)
EncryptTicket encrypts a ticket with the Config's configured (or default) session ticket keys. It can be used as a Config.WrapSession implementation.
func (*Config) SetSessionTicketKeys ¶
SetSessionTicketKeys updates the session ticket keys for a server.
The first key will be used when creating new tickets, while all keys can be used for decrypting tickets. It is safe to call this function while the server is running in order to rotate the session ticket keys. The function will panic if keys is empty.
Calling this function will turn off automatic session ticket key rotation.
If multiple servers are terminating connections for the same host they should all have the same session ticket keys. If the session ticket keys leaks, previously recorded and future TLS connections using those keys might be compromised.
type ConfigExt ¶
type ConfigExt struct {
// AcceptRenegotiation lets a TLS 1.2 server answer a renegotiation the
// client starts. Off by default; a renegotiation the server itself
// asked for (Conn.RequestRenegotiation) is always answered. Only secure
// renegotiation (RFC 5746) is ever performed.
AcceptRenegotiation bool
// EncryptThenMAC offers (client) and accepts (server)
// encrypt_then_mac (RFC 7366) for the TLS 1.2 CBC cipher suites.
EncryptThenMAC bool
// RequireEncryptThenMAC (implies EncryptThenMAC) refuses a CBC suite
// without encrypt_then_mac: a client aborts if the server selects one
// without echoing it, a server does not select one for a client that
// did not offer it.
RequireEncryptThenMAC bool
// SignatureSchemes, if set, replaces the signature_algorithms list this
// side sends (ClientHello, CertificateRequest) and accepts; the
// signature_algorithms_cert list gets them added. It is how
// rsa_pss_pss_* and the brainpool TLS 1.3 schemes are offered.
SignatureSchemes []SignatureScheme
// MaxFragmentLength is the client's max_fragment_length request (RFC
// 6066 4): 1 to 4 for 512, 1024, 2048 or 4096 bytes; 0 asks nothing. A
// server always honours a client's request.
MaxFragmentLength uint8
// RequestOCSPMulti makes a client also send status_request_v2 (RFC
// 6961) asking for ocsp_multi, so a TLS 1.2 server can staple OCSP
// responses for the whole chain.
RequestOCSPMulti bool
// TrustedCAKeys are sent by a client in trusted_ca_keys (RFC 6066 6).
TrustedCAKeys []TrustedAuthority
// CertificateAuthorities are DER distinguished names a client sends in
// certificate_authorities (RFC 8446 4.2.4) when it offers TLS 1.3.
CertificateAuthorities [][]byte
// ServerSessionCache enables TLS 1.2 resumption by session ID on a
// server (session tickets work as upstream).
ServerSessionCache ServerSessionCache
// ClientSessionIDs makes a TLS 1.2 client keep sessions the server
// gave a session ID (and no ticket) in Config.ClientSessionCache and
// offer the ID to resume.
ClientSessionIDs bool
// CipherSuitesTLS13, if set, are the TLS 1.3 cipher suites offered (a
// client) or accepted in this preference order (a server); it allows
// TLS_AES_128_CCM_SHA256, which is not offered by default.
CipherSuitesTLS13 []uint16
// StaticDHCertificate is a server's certificate with a static DH key
// (PrivateKey *DHPrivateKey), used when the client selects
// TLS_DH_RSA_WITH_AES_128_GCM_SHA256 (which Config.CipherSuites must
// list; off by default).
StaticDHCertificate *Certificate
// AttributeCertificates are X.509 attribute certificates (DER) this
// side sends in a SupplementalData message when the peer accepts them
// (RFC 5878 x509_attr_cert, TLS 1.2 full handshakes); none by default.
AttributeCertificates [][]byte
// AcceptAttributeCertificates offers to receive the peer's attribute
// certificates (ConnectionState().Ext.PeerAttributeCertificates).
AcceptAttributeCertificates bool
// AllowSHA1Signatures allows SHA-1 signatures (RSA PKCS #1 v1.5 and
// ECDSA with SHA-1) in TLS 1.2 handshakes for this Config, as GODEBUG
// tlssha1=1 does for the whole process: they are offered last, accepted
// from the peer, and made when the peer prefers them or accepts nothing
// else (also when a TLS 1.2 peer sends no signature_algorithms). It can
// only allow: false follows GODEBUG. TLS 1.3 never uses SHA-1
// signatures. ConnectionState().Ext.SHA1Signature reports their use.
// CertificateRequestInfo.SupportsCertificate, which has no Config,
// follows GODEBUG only.
AllowSHA1Signatures bool
// PSK configures pre-shared keys: TLS 1.2 PSK suites and TLS 1.3
// external PSKs (x_psk.go). Nil: none.
PSK *PSKConfig
// RawPublicKeys configures raw public keys (RFC 7250; x_rpk.go). Nil:
// X.509 only.
RawPublicKeys *RawPublicKeyConfig
// MinKeyUpdateInterval, if positive, lets a TLS 1.3 peer update its
// keys on a timer over an idle connection.
//
// crypto/tls closes a connection with "too many non-advancing records"
// after more than 16 post-handshake messages in a row with no
// application data between them, and since Go 1.26.6 a KeyUpdate no
// longer resets that count: otherwise a peer could make the other side
// derive keys without limit. A peer that renews its keys every few
// minutes on a link that carries no data, as IEC 62351-3 profiles do,
// is then dropped at its 17th update.
//
// With MinKeyUpdateInterval set, a received KeyUpdate that arrives at
// least this long after the previous one that counted (or after the
// handshake, for the first) counts as progress: it is not added to
// that count. A KeyUpdate that arrives sooner counts as upstream does,
// so a flood is still cut off at the same limit, and the number of
// key derivations stays bounded by one per interval plus 16. The
// count is not reset, as application data resets it: other ignored
// messages and fast updates still add up. Times are taken from
// Config.Time when a record is read, so the connection must be read
// while the peer is idle; updates buffered while no one reads arrive
// together and only the first of them counts as progress.
//
// Choose it from the peer's renewal period with a margin for clock
// drift and network delay (for example half the period); a very
// short interval gives back most of the protection. Zero, the
// default, behaves exactly as crypto/tls.
MinKeyUpdateInterval time.Duration
// Observer, if set, is told about key updates and renegotiations. It
// runs on the goroutine doing the work, with connection locks held: it
// must return quickly and must not call methods of the Conn.
Observer func(c *Conn, e Event)
}
ConfigExt are the settings tlsx adds to Config.
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
A Conn represents a secured connection. It implements the net.Conn interface.
func Client ¶
Client returns a new TLS client side connection using conn as the underlying transport. The config cannot be nil: users must set either ServerName or InsecureSkipVerify in the config.
func Dial ¶
Dial connects to the given network address using net.Dial and then initiates a TLS handshake, returning the resulting TLS connection. Dial interprets a nil configuration as equivalent to the zero configuration; see the documentation of Config for the defaults.
func DialWithDialer ¶
DialWithDialer connects to the given network address using dialer.Dial and then initiates a TLS handshake, returning the resulting TLS connection. Any timeout or deadline given in the dialer apply to connection and TLS handshake as a whole.
DialWithDialer interprets a nil configuration as equivalent to the zero configuration; see the documentation of Config for the defaults.
DialWithDialer uses context.Background internally; to specify the context, use Dialer.DialContext with NetDialer set to the desired dialer.
func Server ¶
Server returns a new TLS server side connection using conn as the underlying transport. The configuration config must be non-nil and must include at least one certificate or else set GetCertificate.
func (*Conn) CloseWrite ¶
CloseWrite shuts down the writing side of the connection. It should only be called once the handshake has completed and does not call CloseWrite on the underlying connection. Most callers should just use Conn.Close.
func (*Conn) ConnectionState ¶
func (c *Conn) ConnectionState() ConnectionState
ConnectionState returns basic TLS details about the connection.
The returned ConnectionState is only meaningful after the handshake has completed, as reported by ConnectionState.HandshakeComplete; before then its fields are not populated. The handshake is run automatically by the first Conn.Read or Conn.Write, or it can be triggered explicitly with Conn.Handshake.
func (*Conn) Handshake ¶
Handshake runs the client or server handshake protocol if it has not yet been run.
Most uses of this package need not call Handshake explicitly: the first Conn.Read or Conn.Write will call it automatically.
For control over canceling or setting a timeout on a handshake, use Conn.HandshakeContext or the Dialer's DialContext method instead.
In order to avoid denial of service attacks, the maximum RSA key size allowed in certificates sent by either the TLS server or client is limited to 8192 bits. This limit can be overridden by setting tlsmaxrsasize in the GODEBUG environment variable (e.g. GODEBUG=tlsmaxrsasize=4096).
func (*Conn) HandshakeContext ¶
HandshakeContext runs the client or server handshake protocol if it has not yet been run.
The provided Context must be non-nil. If the context is canceled before the handshake is complete, the handshake is interrupted and an error is returned. Once the handshake has completed, cancellation of the context will not affect the connection.
Most uses of this package need not call HandshakeContext explicitly: the first Conn.Read or Conn.Write will call it automatically.
func (*Conn) NetConn ¶
NetConn returns the underlying connection that is wrapped by c. Note that writing to or reading from this connection directly will corrupt the TLS session.
func (*Conn) OCSPResponse ¶
OCSPResponse returns the stapled OCSP response from the TLS server, if any. (Only valid for client connections.)
func (*Conn) Read ¶
Read reads data from the connection.
As Read calls Conn.Handshake, in order to prevent indefinite blocking a deadline must be set for both Read and Conn.Write before Read is called when the handshake has not yet completed. See Conn.SetDeadline, Conn.SetReadDeadline, and Conn.SetWriteDeadline.
func (*Conn) RemoteAddr ¶
RemoteAddr returns the remote network address.
func (*Conn) Renegotiate ¶
Renegotiate runs a full TLS 1.2 renegotiation as client and returns when it completed. The server's certificate chain is validated again (Config.VerifyConnection runs). A server that refuses (no_renegotiation) leaves the connection as it was and ErrRenegotiationRefusedByPeer is returned.
func (*Conn) RenegotiateContext ¶
RenegotiateContext is Renegotiate (resume false) or Resume (resume true); if ctx ends first the connection is closed.
func (*Conn) RequestRenegotiation ¶
RequestRenegotiation sends a HelloRequest (TLS 1.2 server). The client answers with a ClientHello, which the connection processes as it is read; ConnectionState().Ext.Handshakes counts completed handshakes.
func (*Conn) Resume ¶
Resume runs an abbreviated TLS 1.2 renegotiation as client: the current session (from Config.ClientSessionCache) is resumed on the connection, which gives new keys without a certificate exchange (the session renewal of IEC 62351-3 7.4.4). Without a cached session it is a full renegotiation.
func (*Conn) SendKeyUpdate ¶
SendKeyUpdate sends a TLS 1.3 KeyUpdate and switches to new sending keys (RFC 8446 4.6.3). With requestPeerUpdate the peer is asked to update its sending keys too; its KeyUpdate is processed as the connection is read (ConnectionState().Ext.KeyUpdatesReceived, EventKeyUpdateReceived).
Since Go 1.26.6 a KeyUpdate no longer counts as progress on a connection: a crypto/tls peer, or a tlsx peer without Config.Ext.MinKeyUpdateInterval, closes the connection ("too many non-advancing records") after more than 16 post-handshake messages in a row with no application data between them. Callers that update keys on a timer should make sure some data flows between updates, or that the peer sets that option.
func (*Conn) SetDeadline ¶
SetDeadline sets the read and write deadlines associated with the connection. A zero value for t means Conn.Read and Conn.Write will not time out. After a Write has timed out, the TLS state is corrupt and all future writes will return the same error.
func (*Conn) SetReadDeadline ¶
SetReadDeadline sets the read deadline on the underlying connection. A zero value for t means Conn.Read will not time out.
func (*Conn) SetWriteDeadline ¶
SetWriteDeadline sets the write deadline on the underlying connection. A zero value for t means Conn.Write will not time out. After a Conn.Write has timed out, the TLS state is corrupt and all future writes will return the same error.
func (*Conn) VerifyHostname ¶
VerifyHostname checks that the peer certificate chain is valid for connecting to host. If so, it returns nil; if not, it returns an error describing the problem.
func (*Conn) Write ¶
Write writes data to the connection.
As Write calls Conn.Handshake, in order to prevent indefinite blocking a deadline must be set for both Conn.Read and Write before Write is called when the handshake has not yet completed. See Conn.SetDeadline, Conn.SetReadDeadline, and Conn.SetWriteDeadline.
type ConnectionState ¶
type ConnectionState struct {
// Version is the TLS version used by the connection (e.g. VersionTLS12).
Version uint16
// HandshakeComplete is true if the handshake has concluded.
HandshakeComplete bool
// DidResume is true if this connection was successfully resumed from a
// previous session with a session ticket or similar mechanism.
DidResume bool
// CipherSuite is the cipher suite negotiated for the connection (e.g.
// TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_AES_128_GCM_SHA256).
CipherSuite uint16
// CurveID is the key exchange mechanism used for the connection. The name
// refers to elliptic curves for legacy reasons, see [CurveID]. If a legacy
// RSA key exchange is used, this value is zero.
CurveID CurveID
// NegotiatedProtocol is the application protocol negotiated with ALPN.
NegotiatedProtocol string
// NegotiatedProtocolIsMutual used to indicate a mutual NPN negotiation.
//
// Deprecated: this value is always true.
NegotiatedProtocolIsMutual bool
// ServerName is the value of the Server Name Indication extension sent by
// the client. It's available both on the server and on the client side.
ServerName string
// PeerCertificates are the parsed certificates sent by the peer, in the
// order in which they were sent. The first element is the leaf certificate
// that the connection is verified against.
//
// On the client side, it can't be empty. On the server side, it can be
// empty if Config.ClientAuth is not RequireAnyClientCert or
// RequireAndVerifyClientCert.
//
// PeerCertificates and its contents should not be modified.
PeerCertificates []*x509.Certificate
// VerifiedChains is a list of one or more chains where the first element is
// PeerCertificates[0] and the last element is from Config.RootCAs (on the
// client side) or Config.ClientCAs (on the server side).
//
// On the client side, it's set if Config.InsecureSkipVerify is false. On
// the server side, it's set if Config.ClientAuth is VerifyClientCertIfGiven
// (and the peer provided a certificate) or RequireAndVerifyClientCert.
//
// VerifiedChains and its contents should not be modified.
VerifiedChains [][]*x509.Certificate
// SignedCertificateTimestamps is a list of SCTs provided by the peer
// through the TLS handshake for the leaf certificate, if any.
SignedCertificateTimestamps [][]byte
// OCSPResponse is a stapled Online Certificate Status Protocol (OCSP)
// response provided by the peer for the leaf certificate, if any.
OCSPResponse []byte
// TLSUnique contains the "tls-unique" channel binding value (see RFC 5929,
// Section 3). This value will be nil for TLS 1.3 connections and for
// resumed connections that don't support Extended Master Secret (RFC 7627).
TLSUnique []byte
// ECHAccepted indicates if Encrypted Client Hello was offered by the client
// and accepted by the server. Currently, ECH is supported only on the
// client side.
ECHAccepted bool
// HelloRetryRequest indicates whether we sent a HelloRetryRequest if we
// are a server, or if we received a HelloRetryRequest if we are a client.
HelloRetryRequest bool
// LocalCertificate is the certificate chain presented to the peer, if any,
// during the handshake. This field is only populated for connections which
// are not resumed (DidResume is false).
LocalCertificate [][]byte
// Ext is the state tlsx adds (x_config.go).
Ext StateExt
// contains filtered or unexported fields
}
ConnectionState records basic TLS details about the connection.
func (*ConnectionState) ExportKeyingMaterial ¶
func (cs *ConnectionState) ExportKeyingMaterial(label string, context []byte, length int) ([]byte, error)
ExportKeyingMaterial returns length bytes of exported key material in a new slice as defined in RFC 5705. If context is nil, it is not used as part of the seed. If the connection was set to allow renegotiation via Config.Renegotiation, or if the connections supports neither TLS 1.3 nor Extended Master Secret, this function will return an error.
type CurveID ¶
type CurveID uint16
CurveID is the type of a TLS identifier for a key exchange mechanism. See https://www.iana.org/assignments/tls-parameters/tls-parameters.xml#tls-parameters-8.
In TLS 1.2, this registry used to support only elliptic curves. In TLS 1.3, it was extended to other groups and renamed NamedGroup. See RFC 8446, Section 4.2.7. It was then also extended to other mechanisms, such as hybrid post-quantum KEMs.
const ( // Finite field groups of RFC 7919, for TLS 1.3 key shares and the TLS // 1.2 DHE suites. FFDHE2048 CurveID = 256 FFDHE3072 CurveID = 257 FFDHE4096 CurveID = 258 // Brainpool curves for TLS 1.2 ECDHE (RFC 7027) and TLS 1.3 (RFC 8734). BrainpoolP256r1 CurveID = 26 BrainpoolP384r1 CurveID = 27 BrainpoolP512r1 CurveID = 28 BrainpoolP256r1TLS13 CurveID = 31 BrainpoolP384r1TLS13 CurveID = 32 BrainpoolP512r1TLS13 CurveID = 33 )
Groups tlsx adds.
type DHPrivateKey ¶
type DHPrivateKey struct {
DHPublicKey
X *big.Int
}
DHPrivateKey is a static DH private key (Ext.StaticDHCertificate's PrivateKey).
func GenerateStaticDHKey ¶
func GenerateStaticDHKey(rand io.Reader) (*DHPrivateKey, error)
GenerateStaticDHKey makes a key on the RFC 7919 ffdhe2048 group (Q = (P-1)/2).
func ParseStaticDHKey ¶
func ParseStaticDHKey(der []byte) (*DHPrivateKey, error)
ParseStaticDHKey reads a PKCS #8 DH private key (X9.42 or PKCS #3).
func (*DHPrivateKey) Public ¶
func (k *DHPrivateKey) Public() crypto.PublicKey
Public returns the public half.
type DHPublicKey ¶
DHPublicKey is a finite field Diffie-Hellman public key with its domain parameters (Q may be nil for PKCS #3 keys).
type Dialer ¶
type Dialer struct {
// NetDialer is the optional dialer to use for the TLS connections'
// underlying TCP connections.
// A nil NetDialer is equivalent to the net.Dialer zero value.
NetDialer *net.Dialer
// Config is the TLS configuration to use for new connections.
// A nil configuration is equivalent to the zero
// configuration; see the documentation of Config for the
// defaults.
Config *Config
}
Dialer dials TLS connections given a configuration and a Dialer for the underlying connection.
func (*Dialer) Dial ¶
Dial connects to the given network address and initiates a TLS handshake, returning the resulting TLS connection.
The returned Conn, if any, will always be of type *Conn.
Dial uses context.Background internally; to specify the context, use Dialer.DialContext.
func (*Dialer) DialContext ¶
DialContext connects to the given network address and initiates a TLS handshake, returning the resulting TLS connection.
The provided Context must be non-nil. If the context expires before the connection is complete, an error is returned. Once successfully connected, any expiration of the context will not affect the connection.
type ECHRejectionError ¶
type ECHRejectionError struct {
RetryConfigList []byte
}
ECHRejectionError is the error type returned when ECH is rejected by a remote server. If the server offered a ECHConfigList to use for retries, the RetryConfigList field will contain this list.
The client may treat an ECHRejectionError with an empty set of RetryConfigs as a secure signal from the server.
func (*ECHRejectionError) Error ¶
func (e *ECHRejectionError) Error() string
type EncryptedClientHelloKey ¶
type EncryptedClientHelloKey struct {
// Config should be a marshalled ECHConfig associated with PrivateKey. This
// must match the config provided to clients byte-for-byte. The config must
// use as KEM one of
//
// - DHKEM(P-256, HKDF-SHA256) (0x0010)
// - DHKEM(P-384, HKDF-SHA384) (0x0011)
// - DHKEM(P-521, HKDF-SHA512) (0x0012)
// - DHKEM(X25519, HKDF-SHA256) (0x0020)
// - ML-KEM-768 (0x0041)
// - ML-KEM-1024 (0x0042)
// - MLKEM768-P256 (0x0050)
// - MLKEM1024-P384 (0x0051)
// - MLKEM768-X25519 (0x647a)
//
// and as KDF one of
//
// - HKDF-SHA256 (0x0001)
// - HKDF-SHA384 (0x0002)
// - HKDF-SHA512 (0x0003)
//
// and as AEAD one of
//
// - AES-128-GCM (0x0001)
// - AES-256-GCM (0x0002)
// - ChaCha20Poly1305 (0x0003)
//
Config []byte
// PrivateKey should be a marshalled private key, in the format expected by
// HPKE's DeserializePrivateKey (see RFC 9180), for the KEM used in Config.
PrivateKey []byte
// SendAsRetry indicates if Config should be sent as part of the list of
// retry configs when ECH is requested by the client but rejected by the
// server.
SendAsRetry bool
}
EncryptedClientHelloKey holds a private key that is associated with a specific ECH config known to a client.
type Event ¶
type Event struct {
Kind EventKind
Requested bool
ByPeer bool
Resumed bool
// Version is the negotiated version; PeerVersion is the version the
// peer asked for when it differs (ErrRenegotiationVersionChange).
Version, PeerVersion uint16
Err error
}
Event is a post-handshake event of a connection (ConfigExt.Observer).
type EventKind ¶
type EventKind int
EventKind names an Event.
const ( // EventKeyUpdateSent: this side sent a TLS 1.3 KeyUpdate; Requested // says it asked the peer to update too. EventKeyUpdateSent EventKind = iota + 1 // EventKeyUpdateReceived: the peer's KeyUpdate was processed; // Requested says the peer asked this side to update. EventKeyUpdateReceived // EventHelloRequestSent: the server asked for a renegotiation. EventHelloRequestSent // EventRenegotiationStarted: a TLS 1.2 renegotiation began; ByPeer // says the peer started it. EventRenegotiationStarted // EventRenegotiated: a renegotiation completed; Resumed says it was // abbreviated (session resumption on the connection). EventRenegotiated // EventRenegotiationRefused: a renegotiation was refused before it // started (Err says why: ErrInsecureRenegotiation, // ErrRenegotiationNotAllowed, ErrRenegotiationVersionChange). EventRenegotiationRefused // EventRenegotiationFailed: a renegotiation handshake failed (Err); // the connection is unusable. EventRenegotiationFailed )
type HelloExt ¶
type HelloExt struct {
// PSKModes are the psk_key_exchange_modes offered (0 psk_ke, 1
// psk_dhe_ke).
PSKModes []uint8
// TrustedCAKeys is the client's trusted_ca_keys list, if sent.
TrustedCAKeys []TrustedAuthority
// CertificateAuthorities is the client's certificate_authorities.
CertificateAuthorities [][]byte
// EncryptThenMAC says the client offered encrypt_then_mac.
EncryptThenMAC bool
// MaxFragmentLength is the client's max_fragment_length code (0: none).
MaxFragmentLength uint8
// StatusRequestV2 says the client sent status_request_v2.
StatusRequestV2 bool
// SecureRenegotiation says the client signalled RFC 5746 support
// (renegotiation_info or the SCSV).
SecureRenegotiation bool
// Renegotiation says the ClientHello starts a renegotiation.
Renegotiation bool
}
HelloExt is what tlsx reads from a ClientHello for ClientHelloInfo.
type PSKConfig ¶
type PSKConfig struct {
// Identity and Key are what a client offers: the psk_identity of TLS
// 1.2 and the external identity of TLS 1.3.
Identity, Key []byte
// ClientKey, if set, chooses a TLS 1.2 client's identity and key from
// the server's psk_identity_hint (empty when none was sent); it takes
// precedence over Identity and Key there.
ClientKey func(hint []byte) (identity, key []byte, err error)
// Hint is a TLS 1.2 server's psk_identity_hint (none when empty).
Hint []byte
// Lookup gives a server the key of an identity: nil (and no error)
// for an identity it does not know. It runs in the handshake with the
// handshake's context and must be safe for concurrent use.
Lookup func(ctx context.Context, identity []byte) (key []byte, err error)
// TLS13 offers (client) and accepts (server) the PSK as an external
// PSK in TLS 1.3. Off: TLS 1.3 handshakes use certificates as usual.
TLS13 bool
// Hash is the TLS 1.3 PSK's hash, crypto.SHA256 (the default) or
// crypto.SHA384; only TLS 1.3 suites with that hash can use it.
Hash crypto.Hash
// Resumption allows the sessions of PSK handshakes to be resumed: TLS
// 1.2 PSK sessions by session ticket as upstream, or by session ID with
// Config.Ext.ServerSessionCache and ClientSessionIDs; with TLS13, TLS
// 1.3 sessions of external-PSK handshakes by NewSessionTicket and the
// resumption PSK (RFC 8446 4.6.1). A session stays bound to its PSK:
// before resuming it, a server calls Lookup and a client uses Identity
// and Key (TLS 1.2: or ClientKey, with the hint of the session's full
// handshake), and the session is resumed only if the identity still has
// the same key, so removing or changing a key ends resumption of its
// sessions. A TLS 1.3 client offers the ticket first and its external
// identity second (not with ECH), so a server that cannot resume the
// ticket can fall back to the external PSK; a server tries tickets
// first. psk_ke follows AllowNoDHE and PreferNoDHE on resumption too.
// Off: every PSK handshake is a full one, and no tickets are sent.
Resumption bool
// AllowNoDHE allows TLS 1.3 psk_ke, a key exchange without (EC)DHE
// and so without forward secrecy. A client then offers both modes; a
// server uses psk_ke only when the client offers nothing else or
// PreferNoDHE is set.
AllowNoDHE, PreferNoDHE bool
}
PSKConfig configures pre-shared keys (Config.Ext.PSK).
type QUICConfig ¶
type QUICConfig struct {
TLSConfig *Config
// EnableSessionEvents may be set to true to enable the
// [QUICStoreSession] and [QUICResumeSession] events for client connections.
// When this event is enabled, sessions are not automatically
// stored in the client session cache.
// The application should use [QUICConn.StoreSession] to store sessions.
EnableSessionEvents bool
// ClientHelloInfoConn is the net.Conn to use for the ClientHelloInfo.Conn field.
ClientHelloInfoConn net.Conn
}
A QUICConfig configures a QUICConn.
type QUICConn ¶
type QUICConn struct {
// contains filtered or unexported fields
}
A QUICConn represents a connection which uses a QUIC implementation as the underlying transport as described in RFC 9001.
Methods of QUICConn are not safe for concurrent use.
func QUICClient ¶
func QUICClient(config *QUICConfig) *QUICConn
QUICClient returns a new TLS client side connection using QUICTransport as the underlying transport. The config cannot be nil.
func QUICServer ¶
func QUICServer(config *QUICConfig) *QUICConn
QUICServer returns a new TLS server side connection using QUICTransport as the underlying transport. The config cannot be nil.
func (*QUICConn) ConnectionState ¶
func (q *QUICConn) ConnectionState() ConnectionState
ConnectionState returns basic TLS details about the connection.
func (*QUICConn) HandleData ¶
func (q *QUICConn) HandleData(level QUICEncryptionLevel, data []byte) error
HandleData handles handshake bytes received from the peer. It may produce connection events, which may be read with QUICConn.NextEvent.
func (*QUICConn) NextEvent ¶
NextEvent returns the next event occurring on the connection. It returns an event with a Kind of QUICNoEvent when no events are available.
func (*QUICConn) SendSessionTicket ¶
func (q *QUICConn) SendSessionTicket(opts QUICSessionTicketOptions) error
SendSessionTicket sends a session ticket to the client. It produces connection events, which may be read with QUICConn.NextEvent. Currently, it can only be called once.
func (*QUICConn) SetTransportParameters ¶
SetTransportParameters sets the transport parameters to send to the peer.
Server connections may delay setting the transport parameters until after receiving the client's transport parameters. See QUICTransportParametersRequired.
func (*QUICConn) Start ¶
Start starts the client or server handshake protocol. It may produce connection events, which may be read with QUICConn.NextEvent.
Start must be called at most once.
func (*QUICConn) StoreSession ¶
func (q *QUICConn) StoreSession(session *SessionState) error
StoreSession stores a session previously received in a QUICStoreSession event in the ClientSessionCache. The application may process additional events or modify the SessionState before storing the session.
type QUICEncryptionLevel ¶
type QUICEncryptionLevel int
QUICEncryptionLevel represents a QUIC encryption level used to transmit handshake messages.
func (QUICEncryptionLevel) String ¶
func (l QUICEncryptionLevel) String() string
type QUICEvent ¶
type QUICEvent struct {
Kind QUICEventKind
// Set for QUICSetReadSecret, QUICSetWriteSecret, and QUICWriteData.
Level QUICEncryptionLevel
// Set for QUICTransportParameters, QUICSetReadSecret, QUICSetWriteSecret, and QUICWriteData.
// The contents are owned by crypto/tls, and are valid until the next NextEvent call.
Data []byte
// Set for QUICSetReadSecret and QUICSetWriteSecret.
Suite uint16
// Set for QUICResumeSession and QUICStoreSession.
SessionState *SessionState
// Set for QUICErrorEvent.
// The error will wrap AlertError.
Err error
}
A QUICEvent is an event occurring on a QUIC connection.
The type of event is specified by the Kind field. The contents of the other fields are kind-specific.
type QUICEventKind ¶
type QUICEventKind int
A QUICEventKind is a type of operation on a QUIC connection.
const ( // QUICNoEvent indicates that there are no events available. QUICNoEvent QUICEventKind = iota // QUICSetReadSecret and QUICSetWriteSecret provide the read and write // secrets for a given encryption level. // QUICEvent.Level, QUICEvent.Data, and QUICEvent.Suite are set. // // Secrets for the Initial encryption level are derived from the initial // destination connection ID, and are not provided by the QUICConn. QUICSetReadSecret QUICSetWriteSecret // QUICWriteData provides data to send to the peer in CRYPTO frames. // QUICEvent.Data is set. QUICWriteData // QUICTransportParameters provides the peer's QUIC transport parameters. // QUICEvent.Data is set. QUICTransportParameters // QUICTransportParametersRequired indicates that the caller must provide // QUIC transport parameters to send to the peer. The caller should set // the transport parameters with QUICConn.SetTransportParameters and call // QUICConn.NextEvent again. // // If transport parameters are set before calling QUICConn.Start, the // connection will never generate a QUICTransportParametersRequired event. QUICTransportParametersRequired // QUICRejectedEarlyData indicates that the server rejected 0-RTT data even // if we offered it. It's returned before QUICEncryptionLevelApplication // keys are returned. // This event only occurs on client connections. QUICRejectedEarlyData // QUICHandshakeDone indicates that the TLS handshake has completed. QUICHandshakeDone // QUICResumeSession indicates that a client is attempting to resume a previous session. // [QUICEvent.SessionState] is set. // // For client connections, this event occurs when the session ticket is selected. // For server connections, this event occurs when receiving the client's session ticket. // // The application may set [QUICEvent.SessionState.EarlyData] to false before the // next call to [QUICConn.NextEvent] to decline 0-RTT even if the session supports it. QUICResumeSession // QUICStoreSession indicates that the server has provided state permitting // the client to resume the session. // [QUICEvent.SessionState] is set. // The application should use [QUICConn.StoreSession] session to store the [SessionState]. // The application may modify the [SessionState] before storing it. // This event only occurs on client connections. QUICStoreSession // QUICErrorEvent indicates that a fatal error has occurred. // The handshake cannot proceed and the connection must be closed. // QUICEvent.Err is set. QUICErrorEvent )
type RawPublicKeyConfig ¶
type RawPublicKeyConfig struct {
// Send authenticates this side with the public key of its certificate's
// private key as a raw public key when the peer accepts one. The
// Certificate may then have no X.509 chain (PrivateKey only); with a
// chain, X.509 remains the choice for a peer that does not accept raw
// keys.
Send bool
// Verify accepts the peer's raw public key (DER SubjectPublicKeyInfo),
// typically against a pinned set; a nil error accepts it. Nil: raw keys
// from the peer are not accepted.
Verify func(spki []byte) error
// RawOnly refuses X.509 certificates from the peer.
RawOnly bool
}
RawPublicKeyConfig configures raw public keys (Config.Ext.RawPublicKeys).
type RecordHeaderError ¶
type RecordHeaderError struct {
// Msg contains a human readable string that describes the error.
Msg string
// RecordHeader contains the five bytes of TLS record header that
// triggered the error.
RecordHeader [5]byte
// Conn provides the underlying net.Conn in the case that a client
// sent an initial handshake that didn't look like TLS.
// It is nil if there's already been a handshake or a TLS alert has
// been written to the connection.
Conn net.Conn
}
RecordHeaderError is returned when a TLS record header is invalid.
func (RecordHeaderError) Error ¶
func (e RecordHeaderError) Error() string
type RenegotiationSupport ¶
type RenegotiationSupport int
RenegotiationSupport enumerates the different levels of support for TLS renegotiation. TLS renegotiation is the act of performing subsequent handshakes on a connection after the first. This significantly complicates the state machine and has been the source of numerous, subtle security issues. Initiating a renegotiation is not supported, but support for accepting renegotiation requests may be enabled.
Even when enabled, the server may not change its identity between handshakes (i.e. the leaf certificate must be the same). Additionally, concurrent handshake and application data flow is not permitted so renegotiation can only be used with protocols that synchronise with the renegotiation, such as HTTPS.
Renegotiation is not defined in TLS 1.3.
const ( // RenegotiateNever disables renegotiation. RenegotiateNever RenegotiationSupport = iota // RenegotiateOnceAsClient allows a remote server to request // renegotiation once per connection. RenegotiateOnceAsClient // RenegotiateFreelyAsClient allows a remote server to repeatedly // request renegotiation. RenegotiateFreelyAsClient )
type ServerSessionCache ¶
type ServerSessionCache interface {
Get(sessionID string) (*SessionState, bool)
Put(sessionID string, s *SessionState)
}
ServerSessionCache stores TLS 1.2 sessions by session ID on a server. Implementations must be safe for concurrent use.
type SessionState ¶
type SessionState struct {
// Extra is ignored by crypto/tls, but is encoded by [SessionState.Bytes]
// and parsed by [ParseSessionState].
//
// This allows [Config.UnwrapSession]/[Config.WrapSession] and
// [ClientSessionCache] implementations to store and retrieve additional
// data alongside this session.
//
// To allow different layers in a protocol stack to share this field,
// applications must only append to it, not replace it, and must use entries
// that can be recognized even if out of order (for example, by starting
// with an id and version prefix).
Extra [][]byte
// EarlyData indicates whether the ticket can be used for 0-RTT in a QUIC
// connection. The application may set this to false if it is true to
// decline to offer 0-RTT even if supported.
EarlyData bool
// contains filtered or unexported fields
}
A SessionState is a resumable session.
func ParseSessionState ¶
func ParseSessionState(data []byte) (*SessionState, error)
ParseSessionState parses a SessionState encoded by SessionState.Bytes.
func (*SessionState) Bytes ¶
func (s *SessionState) Bytes() ([]byte, error)
Bytes encodes the session, including any private fields, so that it can be parsed by ParseSessionState. The encoding contains secret values critical to the security of future and possibly past sessions.
The specific encoding should be considered opaque and may change incompatibly between Go versions.
type SignatureScheme ¶
type SignatureScheme uint16
SignatureScheme identifies a signature algorithm supported by TLS. See RFC 8446, Section 4.2.3.
const ( // RSASSA-PKCS1-v1_5 algorithms. PKCS1WithSHA256 SignatureScheme = 0x0401 PKCS1WithSHA384 SignatureScheme = 0x0501 PKCS1WithSHA512 SignatureScheme = 0x0601 // RSASSA-PSS algorithms with public key OID rsaEncryption. PSSWithSHA256 SignatureScheme = 0x0804 PSSWithSHA384 SignatureScheme = 0x0805 PSSWithSHA512 SignatureScheme = 0x0806 // ECDSA algorithms. Only constrained to a specific curve in TLS 1.3. ECDSAWithP256AndSHA256 SignatureScheme = 0x0403 ECDSAWithP384AndSHA384 SignatureScheme = 0x0503 ECDSAWithP521AndSHA512 SignatureScheme = 0x0603 // EdDSA algorithms. Ed25519 SignatureScheme = 0x0807 // ML-DSA algorithms. MLDSA44 SignatureScheme = 0x0904 MLDSA65 SignatureScheme = 0x0905 MLDSA87 SignatureScheme = 0x0906 // Legacy signature and hash algorithms for TLS 1.2. PKCS1WithSHA1 SignatureScheme = 0x0201 ECDSAWithSHA1 SignatureScheme = 0x0203 )
const ( // RSASSA-PSS with a public key of OID id-RSASSA-PSS (RFC 8446 4.2.3). PSSPSSWithSHA256 SignatureScheme = 0x0809 PSSPSSWithSHA384 SignatureScheme = 0x080a PSSPSSWithSHA512 SignatureScheme = 0x080b // ECDSA on the brainpool curves in TLS 1.3 (RFC 8734). ECDSABrainpoolP256r1TLS13WithSHA256 SignatureScheme = 0x081a ECDSABrainpoolP384r1TLS13WithSHA384 SignatureScheme = 0x081b ECDSABrainpoolP512r1TLS13WithSHA512 SignatureScheme = 0x081c )
Signature schemes tlsx adds.
func (SignatureScheme) String ¶
func (i SignatureScheme) String() string
type StateExt ¶
type StateExt struct {
// EncryptThenMAC says encrypt_then_mac is in use (TLS 1.2 CBC suites).
EncryptThenMAC bool
// MaxFragmentLength is the negotiated record plaintext limit in bytes
// (0: none, 16384).
MaxFragmentLength int
// SecureRenegotiation says the peer signalled RFC 5746 support in the
// first handshake (TLS 1.2).
SecureRenegotiation bool
// Handshakes counts completed handshakes on the connection (1 plus
// renegotiations).
Handshakes int
// KeyUpdatesSent and KeyUpdatesReceived count TLS 1.3 KeyUpdate
// messages.
KeyUpdatesSent, KeyUpdatesReceived uint64
// LastKeyUpdateReceived is when the peer last updated its keys.
LastKeyUpdateReceived time.Time
// OCSPResponses are the stapled OCSP responses by position in
// PeerCertificates (nil where none was stapled); OCSPResponse is
// OCSPResponses[0].
OCSPResponses [][]byte
// SessionCreated is, on a TLS 1.2 server connection that resumed a
// session (ticket or session ID), when the session's full handshake
// was made (zero otherwise).
SessionCreated time.Time
// TrustedCAKeysAcknowledged says the server confirmed it chose its
// certificate by the client's trusted_ca_keys (RFC 6066 6).
TrustedCAKeysAcknowledged bool
// PeerCertificateAuthorities are the DER names the peer sent in
// certificate_authorities (a client's ClientHello, a server's
// CertificateRequest).
PeerCertificateAuthorities [][]byte
// PeerAttributeCertificates are the attribute certificates the peer
// sent (RFC 5878), unverified: the application checks them.
PeerAttributeCertificates [][]byte
// PSKIdentity is the pre-shared key identity the handshake used (nil
// when none; empty but not nil for an empty TLS 1.2 identity);
// PSKIdentityHint the TLS 1.2 server's hint a client got.
PSKIdentity, PSKIdentityHint []byte
// SHA1Signature says a TLS 1.2 handshake on the connection used a
// SHA-1 signature, by either side (Config.Ext.AllowSHA1Signatures,
// GODEBUG tlssha1=1).
SHA1Signature bool
// PeerRawPublicKey is the peer's raw public key (DER
// SubjectPublicKeyInfo, RFC 7250) when it authenticated with one;
// PeerCertificates is then empty. OwnRawPublicKey says this side sent
// a raw public key.
PeerRawPublicKey []byte
OwnRawPublicKey bool
}
StateExt is the connection state tlsx adds to ConnectionState.
type TrustedAuthority ¶
type TrustedAuthority struct {
// Type is 0 pre_agreed, 1 key_sha1_hash, 2 x509_name, 3 cert_sha1_hash.
Type uint8
// Data is the SHA-1 hash (types 1 and 3) or the DER distinguished name
// (type 2); empty for pre_agreed.
Data []byte
}
TrustedAuthority is one entry of trusted_ca_keys (RFC 6066 6).
func TrustedAuthoritiesFor ¶
func TrustedAuthoritiesFor(cas [][]byte) ([]TrustedAuthority, error)
TrustedAuthoritiesFor lists the trusted_ca_keys entries that name the CA certificates given (DER): key_sha1_hash and x509_name of each.
Notes ¶
Bugs ¶
The crypto/tls package only implements some countermeasures against Lucky13 attacks on CBC-mode encryption, and only on SHA1 variants. See http://www.isg.rhul.ac.uk/tls/TLStiming.pdf and https://www.imperialviolet.org/2013/02/04/luckythirteen.html.
Source Files
¶
- alert.go
- auth.go
- cache.go
- cipher_suites.go
- common.go
- common_string.go
- conn.go
- defaults.go
- defaults_fips140.go
- doc.go
- ech.go
- gcm_tls.go
- handshake_client.go
- handshake_client_tls13.go
- handshake_messages.go
- handshake_server.go
- handshake_server_tls13.go
- key_agreement.go
- key_schedule.go
- prf.go
- quic.go
- ticket.go
- tls.go
- upstream_shims.go
- x_authz.go
- x_certs.go
- x_config.go
- x_conn.go
- x_godebug.go
- x_groups.go
- x_handshake.go
- x_messages.go
- x_psk.go
- x_psk_resume.go
- x_psk_resume13.go
- x_renegotiation.go
- x_rpk.go
- x_sha1.go
- x_staticdh.go
- x_suites.go
Directories
¶
| Path | Synopsis |
|---|---|
|
internal
|
|
|
boring
Package boring stands in for the standard library's crypto/internal/boring in the upstream crypto/tls tests that tlsx carries: tlsx is never built with BoringCrypto.
|
Package boring stands in for the standard library's crypto/internal/boring in the upstream crypto/tls tests that tlsx carries: tlsx is never built with BoringCrypto. |
|
brainpool
Package brainpool implements the elliptic curves brainpoolP256r1, brainpoolP384r1 and brainpoolP512r1 (RFC 5639) for use by our fork of crypto/tls: ECDHE with the TLS named curves of RFC 7027 (26, 27, 28 in TLS 1.2; the TLS 1.3 groups 31, 32, 33 use the same curves) and ECDSA with brainpool keys, including DER key encodings and X.509 certificates whose keys or issuers are on these curves (crypto/x509 only knows the NIST curves).
|
Package brainpool implements the elliptic curves brainpoolP256r1, brainpoolP384r1 and brainpoolP512r1 (RFC 5639) for use by our fork of crypto/tls: ECDHE with the TLS named curves of RFC 7027 (26, 27, 28 in TLS 1.2; the TLS 1.3 groups 31, 32, 33 use the same curves) and ECDSA with brainpool keys, including DER key encodings and X.509 certificates whose keys or issuers are on these curves (crypto/x509 only knows the NIST curves). |
|
ccm
Package ccm implements the CCM mode of a 128-bit block cipher (RFC 3610, NIST SP 800-38C) as a crypto/cipher AEAD, for tlsx's CCM cipher suites (TLS_AES_128_CCM_SHA256 and TLS_AES_128_CCM_8_SHA256, RFC 8446 B.4; the TLS 1.2 PSK CCM suites of RFC 6655).
|
Package ccm implements the CCM mode of a 128-bit block cipher (RFC 3610, NIST SP 800-38C) as a crypto/cipher AEAD, for tlsx's CCM cipher suites (TLS_AES_128_CCM_SHA256 and TLS_AES_128_CCM_8_SHA256, RFC 8446 B.4; the TLS 1.2 PSK CCM suites of RFC 6655). |
|
cryptotest
Package cryptotest stands in for the standard library's crypto/internal/cryptotest in the upstream crypto/tls tests that tlsx carries.
|
Package cryptotest stands in for the standard library's crypto/internal/cryptotest in the upstream crypto/tls tests that tlsx carries. |
|
testenv
Package testenv stands in for the standard library's internal/testenv in the upstream crypto/tls tests that tlsx carries.
|
Package testenv stands in for the standard library's internal/testenv in the upstream crypto/tls tests that tlsx carries. |
|
testports
Package testports hands tests loopback ports for servers they configure by address before the server binds.
|
Package testports hands tests loopback ports for servers they configure by address before the server binds. |
|
tls13
Package tls13 implements the TLS 1.3 Key Schedule as specified in RFC 8446, Section 7.1 and allowed by FIPS 140-3 IG 2.4.B Resolution 7.
|
Package tls13 implements the TLS 1.3 Key Schedule as specified in RFC 8446, Section 7.1 and allowed by FIPS 140-3 IG 2.4.B Resolution 7. |
|
Package revocation checks certificate chains against certificate revocation lists (CRLs, RFC 5280 section 5).
|
Package revocation checks certificate chains against certificate revocation lists (CRLs, RFC 5280 section 5). |