Skip to content

About

TLS-SRP client and server for Go: TLS 1.2 with SRP password authentication (RFC 5054), built from crypto/tls. Supports all RFC 5054 groups and cipher suites, Extended Master Secret, tls-unique channel binding and keying material exporters

Topics

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

59 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-tls-srp

GitHub Release Go Reference License Tests Interoperability Supply chain OpenSSF Scorecard

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.

Contents

Install

go get github.com/misiektoja/go-tls-srp

The module needs Go 1.27.3 or newer. The package is imported as srptls:

import srptls "github.com/misiektoja/go-tls-srp"

Scope

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.

Getting started

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.

Documentation

Full documentation is at misiektoja.github.io/go-tls-srp.

The package documentation on pkg.go.dev describes every exported identifier. Repository files:

Limitations

  • 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.Conn is not a *tls.Conn, so net/http leaves Request.TLS and Response.TLS nil 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.

Support

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.

Licence

BSD-3-Clause, the licence of the Go project. See LICENSE.

About

TLS-SRP client and server for Go: TLS 1.2 with SRP password authentication (RFC 5054), built from crypto/tls. Supports all RFC 5054 groups and cipher suites, Extended Master Secret, tls-unique channel binding and keying material exporters

Topics

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages