
Product
Socket Threat Intel Now Shows Which Malware Campaigns Were Blocked or Detected
Socket Threat Intel now shows which malware campaigns were blocked or detected in your organization, with links to scans and Firewall events.
darvaza.org/x/tlsThe tls package provides advanced TLS/SSL certificate handling utilities
that extend Go's standard crypto/tls package: the Store abstraction, SNI
inspection, certificate bundling, and enhanced x509 utilities.
Unlike the standard library's static configuration, a Store is a living
source of certificates and trust — material is added, renewed and removed while
in use. The Store interfaces are designed to be layered, so higher-level
systems can compose behaviour (on-demand issuance, replication) over a simple
local store while keeping it both flexible and consistent.
The Store interfaces describe a dynamic source of certificates and trust. A
read/write store adds lookup, iteration and the building-block writers
(AddCACerts, AddPrivateKey, AddCert, AddCertPair) on top of the base
Store. Any implementation wires straight into a tls.Config:
// store is any tls.Store implementation.
config, err := tls.NewConfig(store)
// or bind one to an existing config:
err = tls.WithStore(config, store)
WithStore sets GetCertificate, RootCAs and ClientCAs from the store.
Automatic certificate chain building with quality optimization.
bundler := &tls.Bundler{
Roots: systemRoots,
Inter: intermediateCerts,
Less: func(a, b []*x509.Certificate) bool {
// Prefer shorter chains
return len(a) < len(b)
},
}
// Bundle certificate with optimal chain
tlsCert, err := bundler.Bundle(cert, privateKey)
Parse ClientHello packets without full TLS handshake.
// Parse SNI from ClientHello
info := sni.GetInfo(clientHelloBytes)
if info != nil {
fmt.Printf("SNI: %s\n", info.ServerName)
}
// SNI-based routing: GetHandler claims a connection for a dedicated
// Handler, or returns nil to let it fall through to the TLS listener.
dispatcher := &sni.Dispatcher{
GetHandler: func(chi *tls.ClientHelloInfo) sni.Handler {
if chi.ServerName == "example.com" {
return exampleHandler
}
return nil
},
}
go dispatcher.Serve(rawListener) // feed it the raw net.Listener
tlsListener := tls.NewListener(dispatcher, cfg) // unclaimed ones land here
sniServer Name Indication parsing and routing.
storeLoading and population for a Store.
buffer: collect certificates and keys, then flush them into a Store.config: load certificates and keys from configuration and PEM sources.x509utilsEnhanced X.509 certificate utilities.
certpool: Advanced certificate pool management.// Create custom cert pool
pool := certpool.New()
pool.AddCert(rootCA)
// Clone and extend system pool
sysPool, _ := certpool.SystemCertPool()
customPool := sysPool.Clone()
customPool.AddCert(internalCA)
// Decode certificates from PEM via a per-block callback
err := x509utils.ReadPEM(pemData, func(_ fs.FS, _ string, block *pem.Block) bool {
if cert, err := x509utils.BlockToCertificate(block); err == nil {
certs = append(certs, cert)
}
return true // keep reading
})
// Encode a certificate (DER) back to PEM
pemBytes := x509utils.EncodeCertificate(cert.Raw)
// Verify a tls.Certificate. Pass a roots pool to also verify the chain;
// nil checks only the certificate's own validity.
err := tls.Verify(cert, customRoots)
go get darvaza.org/x/tls
darvaza.org/core: Core utilities.darvaza.org/slog: Structured logging.darvaza.org/x/container: Data structures.darvaza.org/x/sync: Synchronisation primitives.github.com/ebitengine/purego: macOS system certificate
store FFI.github.com/zeebo/blake3: Certificate hashing.golang.org/x/crypto: Low-level crypto parsing.golang.org/x/sys: Windows system certificate store.For development guidelines, architecture notes, and AI agent instructions, see AGENTS.md.
This project is licensed under the MIT Licence. See LICENCE.txt for details.
FAQs
Unknown package

Product
Socket Threat Intel now shows which malware campaigns were blocked or detected in your organization, with links to scans and Firewall events.

Security News
Fixes for eMudhra and Brotli are out. Getting them everywhere they’re needed means tracking down bundled libraries, runtimes, and certificate stores.

Threat Research
/Security News
Socket uncovered secret-stealing workflows that ran in LiteLLM’s GitHub repository 11 days before the supply chain attack on PyPI and Docker.