Package srptls is a TLS 1.2 client and server that sign in with SRP, the Secure Remote Password key
exchange of RFC 5054. The client proves that it knows a
password. The server stores only a verifier derived from the password, needs no certificate and
proves to the client that it holds the verifier.
Go's crypto/tls has no SRP. This module is a trimmed copy of crypto/tls from Go 1.27.2 that keeps
only the SRP handshake. It is written for systems that already use TLS-SRP, such as EST enrollment
with certificate-less mutual authentication.
go get github.com/misiektoja/go-tls-srpThe module needs Go 1.27.3 or newer. The package is imported as srptls:
import srptls "github.com/misiektoja/go-tls-srp"| Standard | Coverage | Enabled by |
|---|---|---|
| RFC 5054 TLS-SRP | Client and server over TLS 1.2, the seven groups of Appendix A, TLS_SRP_SHA_WITH_AES_256_CBC_SHA and TLS_SRP_SHA_WITH_AES_128_CBC_SHA |
Always |
| RFC 5054 3DES suite | TLS_SRP_SHA_WITH_3DES_EDE_CBC_SHA |
Config.CipherSuites |
| RFC 5054 small groups | The 1024 and 1536 bit groups on the client | Config.MinGroupBits |
| RFC 7627 Extended Master Secret | Always offered by the client, used by the server when offered | Always |
| RFC 5746 renegotiation indication | Signaling only, renegotiation is refused | Always |
| RFC 6066 server name indication | Sent by the client, reported on both sides | Config.ServerName |
RFC 5929 tls-unique |
ConnectionState.TLSUnique on both sides |
Always |
| RFC 5705 keying material exporters | ConnectionState.ExportKeyingMaterial |
Extended Master Secret |
The client is tested against OpenSSL 1.1.1w s_server in CI, see
Tested implementations.
The server returns the stored verifier for the username in the ClientHello. The client signs in with the username and the password:
l, err := srptls.Listen("tcp", ":8443", &srptls.Config{
GetVerifier: func(info *srptls.ClientHelloInfo) (*srptls.Verifier, error) {
return lookupVerifier(info.Username)
},
})
conn := srptls.Client(raw, &srptls.Config{
Username: "device-1",
Password: password,
ServerName: "est.example",
})
err = conn.HandshakeContext(ctx)NewVerifier creates a verifier from a password and a salt from NewSalt. A failed handshake wraps
ErrWrongPassword when the password is wrong.
Getting started runs a complete server
and client. Example in example_test.go is the same program.
Full documentation is at misiektoja.github.io/go-tls-srp.
- Getting started
- Support matrix
- Architecture
- Running a server and Connecting as a client
- Verifiers and groups, including OpenSSL verifier files
- Unknown usernames and refusals
- Channel binding and Extended Master Secret
- Cipher suites
- Errors and alerts
- Security model
The package documentation on pkg.go.dev describes every exported identifier. Repository files:
- CONTRIBUTING.md lists the development checks and how the copy of
crypto/tlsfollows Go releases. - SECURITY.md explains how to report a vulnerability.
- RELEASE_NOTES.md records user-visible changes per release.
- TLS 1.2 only, with the SRP cipher suites that need no certificate. No TLS 1.3.
- Only the seven groups of RFC 5054, Appendix A.
- No session resumption and no renegotiation. Every connection runs a full handshake.
*srptls.Connis not a*tls.Conn, sonet/httpleavesRequest.TLSandResponse.TLSnil and cannot negotiate HTTP/2.- No handshake deadline, connection limit or limit on failed sign-ins. The server must set them, as the Security model describes.
Known limitations explains each gap.
Ask questions and report bugs in GitHub issues. Include the module version, the Go version, the peer and its version and the handshake error of both sides. Report vulnerabilities privately as SECURITY.md describes.
BSD-3-Clause, the licence of the Go project. See LICENSE.