What version of Go are you using (go version)?
$ go version
go version go1.19.2 linux/amd64
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (go env)?
go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="~/.cache/go-build"
GOENV="~/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="~/go/pkg/mod"
GOOS="linux"
GOPATH="~/go"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="~/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="~/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.19.2"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="~/tmp/tlsv13-bug/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build2371020500=/tmp/go-build -gno-record-gcc-switches"
What did you do?
I'm trying to verify expired client TLS certificate on the client side using Handshake() method, but it returns nothing.
What did you expect to see?
I expect to get bad certificate error returned by Handshake() method on the client side.
What did you see instead?
Handshake() is called w/o error and I get bad certificate error only once client starts sending data over established TLSv1.3 connection. I created a test case showing that TLSv1.3 doesn't work as expected, while TLSv1.2 works as expected.
https://gist.github.com/kayrus/096e129bd4f6a5cf9f41bff06c7eeb83
Result:
$ go run .
2022/10/21 15:49:43.321628 CLIENT: calling: TLSv1.2
2022/10/21 15:49:43.324478 SERVER: tls handshake failed: tls: failed to verify client certificate: x509: certificate has expired or is not yet valid: current time 2022-10-21T15:49:43+02:00 is after 2022-10-21T10:51:46Z
2022/10/21 15:49:43.324501 CLIENT: TLS client Handshake failed: remote error: tls: bad certificate
2022/10/21 15:49:43.324517 CLIENT: calling: TLSv1.3
2022/10/21 15:49:43.327171 SERVER: tls handshake failed: tls: failed to verify client certificate: x509: certificate has expired or is not yet valid: current time 2022-10-21T15:49:43+02:00 is after 2022-10-21T10:51:46Z
2022/10/21 15:49:43.327184 CLIENT: ERROR: server must return a handshake error
exit status 1
What version of Go are you using (
go version)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env)?go envOutputWhat did you do?
I'm trying to verify expired client TLS certificate on the client side using
Handshake()method, but it returns nothing.What did you expect to see?
I expect to get
bad certificateerror returned byHandshake()method on the client side.What did you see instead?
Handshake()is called w/o error and I getbad certificateerror only once client starts sending data over established TLSv1.3 connection. I created a test case showing that TLSv1.3 doesn't work as expected, while TLSv1.2 works as expected.https://gist.github.com/kayrus/096e129bd4f6a5cf9f41bff06c7eeb83
Result: