Skip to content

v1.3.2 bug fixes, robustness, and new (beta) ClientHelloSpecs

Compare
Choose a tag to compare
@gaukas gaukas released this 07 Apr 03:25
· 283 commits to master since this release
v1.3.2
c785bd3

What's Changed

Note

Added HelloChrome_100_PSK and HelloChrome_112_PSK_Shuf, which includes PreSharedKey automatically instead of Padding as the last TLS extensions.

To use them correctly, you are required to use (*UConn).ApplyPreset():

conn := utls.UClient(plainConn, utlsConfig, utls.HelloCustom)
preset, err := utls.UTLSIdToSpec(utls.HelloChrome_112_PSK_Shuf) // correct
if err != nil {
	return nil, err
}
if pskExt, ok := preset.Extensions[len(preset.Extensions)-1].(*utls.FakePreSharedKeyExtension); ok {
	pskExt.PskIdentities = []utls.PskIdentity{ // must set identity
		{
			Label:               []byte("blahblahblah"), // change this
			ObfuscatedTicketAge: 0, // change this
		},
	}
	// each fake binder is 32 bytes of zeros
	pskExt.PskBinders = [][]byte{ // must set psk binders
		{
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // change this
		},
	} // byte slices
}
conn.ApplyPreset(&preset) // make sure to apply preset to the connection

Instead of

conn := utls.UClient(plainConn, utlsConfig, utls.HelloChrome_112_PSK_Shuf) // incorrect! PSK extension will use empty payload!

New Contributors

Full Changelog: v1.3.1...v1.3.2