-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
crypto/tls: TLS 1.2 SupportedSignatureAlgorithms not honored in Server Hello Certificate Request #40344
Comments
cc @FiloSottile |
Maybe change if c.vers >= VersionTLS12 {
certReq.hasSignatureAlgorithm = true
certReq.supportedSignatureAlgorithms = supportedSignatureAlgorithms
} With if c.vers >= VersionTLS12 {
certReq.hasSignatureAlgorithm = true
certReq.supportedSignatureAlgorithms = hs.cert.SupportedSignatureAlgorithms
} Can do the tricks? Or maybe filter Signature Algorithms like in https://github.com/golang/go/blob/master/src/crypto/tls/auth.go#L148 var rsaSignatureSchemes = []struct {
scheme SignatureScheme
minModulusBytes int
maxVersion uint16
}{
// RSA-PSS is used with PSSSaltLengthEqualsHash, and requires
// emLen >= hLen + sLen + 2
{PSSWithSHA256, crypto.SHA256.Size()*2 + 2, VersionTLS13},
{PSSWithSHA384, crypto.SHA384.Size()*2 + 2, VersionTLS13},
{PSSWithSHA512, crypto.SHA512.Size()*2 + 2, VersionTLS13},
// PKCS #1 v1.5 uses prefixes from hashPrefixes in crypto/rsa, and requires
// emLen >= len(prefix) + hLen + 11
// TLS 1.3 dropped support for PKCS #1 v1.5 in favor of RSA-PSS.
{PKCS1WithSHA256, 19 + crypto.SHA256.Size() + 11, VersionTLS12},
{PKCS1WithSHA384, 19 + crypto.SHA384.Size() + 11, VersionTLS12},
{PKCS1WithSHA512, 19 + crypto.SHA512.Size() + 11, VersionTLS12},
{PKCS1WithSHA1, 15 + crypto.SHA1.Size() + 11, VersionTLS12},
} & https://github.com/golang/go/blob/master/src/crypto/tls/auth.go#L205 for _, candidate := range rsaSignatureSchemes {
if size >= candidate.minModulusBytes && version <= candidate.maxVersion {
sigAlgs = append(sigAlgs, candidate.scheme)
}
} ? |
This seems to be mixing up two separate sets of signature algorithms: Certificate.SupportedSignatureAlgorithms are the ones that can be used to make a signature from the certificate; certReq.supportedSignatureAlgorithms are the algorithms that the client is allowed to use. The former is limited by the private key of the certificate (if for example it's an a hardware token that can't do RSA-PSS), the latter is only limited by what out implementation can verify, which is always the same set. Why do you need to configure certReq.supportedSignatureAlgorithms? |
I need to configure it with some hardware token (HID activekey sim) to work with Firefox which doesn't seem to support well RSA-PSS with it. To get it working fully i need to disable rsa-pss algorithm in Server Hello Certificate Request. In Go < 1.14, everything where good but after upgrading it broke. The snippet reproduce the behaviour of Traefik which recently upgrade to to Go 1.14. I think we need something to be able to configure |
This sounds like it should be reported to Firefox. They should not use signature algorithms that are not supported by the token. We had the equivalent issue with Go clients using tokens that don't support RSA-PSS, and we fixed it by adding Certificate.SupportedSignatureAlgorithms. The solution to a client using the wrong algorithm can't be to make the whole ecosystem turn off that algorithm, especially when there is already a negotiation process where the server just says "here are the algorithms I support" (and indeed supports them) and the client gets to pick which one to use. In general, we don't add configuration options if not strictly necessary, sorry. If you have to support a niche, broken client, you'll have to fork because it does not justify adding complexity for the whole ecosystem. |
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
)?Windows 10 & GNU/Linux x64 & OSX
go env
OutputWhat did you do?
Limit
SupportedSignatureAlgorithms
on Certificate.Snippet:
What did you expect to see?
Only
SupportedSignatureAlgorithms
values in Server Hello Certificate Request.What did you see instead?
All
common.go/supportedSignatureAlgorithms
values.common.go
:handshake_server.go/doFullHandshake
:The text was updated successfully, but these errors were encountered: