-
Notifications
You must be signed in to change notification settings - Fork 18k
crypto/x509: can't verify signature on RSA-PSS certificate requests it created #45990
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
Comments
I've tracked down the check that fail the verification : Line 132 in 04cd717
|
I've checked the output of x509.CreateCertificateRequest against OpenSSL : It fails. So I bet that the bug is on the creation side.
EDIT : I've checked that a RSA-PSS CSR created by OpenSSL was correctly verified by |
It seems that Here is the backtrace got by step through
|
In case of a RSA-PSS algorithm, the hashFunc of CreateCertificateRequest is embedded in a rsa.PSSOptions struct. Given to key.Sign(), this will generate a proper RSA-PSS signature. Pasted from the RSA-PSS handling code in CreateCertificate() Fixes golang#45990
I found a fix (#46029). I just need to get the CLA signed (hence the draft status of the PR) (EDIT |
In case of a RSA-PSS algorithm, the hashFunc of CreateCertificateRequest is embedded in a rsa.PSSOptions struct. Given to key.Sign(), this will generate a proper RSA-PSS signature. Pasted from the RSA-PSS handling code in CreateCertificate() Fixes golang#45990
CC @golang/security Looks like this didn't make 1.19. Moving to backlog. Please recategorize as appropriate. |
Hi! The CLA is now signed for the linked PR (#46029) but I don't know how to convince the bot to rescan the PR. Maybe someone on this issue can help? |
In case of a RSA-PSS algorithm, the hashFunc of CreateCertificateRequest is embedded in a rsa.PSSOptions struct. Given to key.Sign(), this will generate a proper RSA-PSS signature. Pasted from the RSA-PSS handling code in CreateCertificate() Fixes golang#45990
... I just had to push new commits. All is ready to be reviewed/merged now. |
In case of a RSA-PSS algorithm, the hashFunc of CreateCertificateRequest is embedded in a rsa.PSSOptions struct. Given to key.Sign(), this will generate a proper RSA-PSS signature. Pasted from the RSA-PSS handling code in CreateCertificate() Fixes golang#45990
In case of a RSA-PSS algorithm, the hashFunc of CreateCertificateRequest is embedded in a rsa.PSSOptions struct. Given to key.Sign(), this will generate a proper RSA-PSS signature. Pasted from the RSA-PSS handling code in CreateCertificate() Fixes golang#45990
Change https://go.dev/cl/431875 mentions this issue: |
…e api - Mainly to work properly with GCP backed managed keys, we need to issue signatures that would match the GCP key algorithm. - At this time due to golang/go#45990 we can't issue PSS signed CSRs, as the libraries in Go always request a PKCS1v15. - Add an extra check in intermediate/generate that validates the CSR's signature before providing it back to the client in case we generated a bad signature such as if an end-user used a GCP backed managed key with a RSA PSS algorithm. - GCP ignores the requested signature type and always signs with the key's algorithm which can lead to a CSR that says it is signed with a PKCS1v15 algorithm but is actually a RSA PSS signature
In case of a RSA-PSS algorithm, the hashFunc of CreateCertificateRequest is embedded in a rsa.PSSOptions struct. Given to key.Sign(), this will generate a proper RSA-PSS signature. Pasted from the RSA-PSS handling code in CreateCertificate() Fixes golang#45990
Any news on that topic? https://go-review.googlesource.com/c/go/+/431916 fixes the issue but seems to be forgotten. |
@phlipse I'm sorry but I don't have any :( I've kept things updated here, at https://go-review.googlesource.com/c/go/+/431916 (as you found) and #55153. I've tried to ping but without success. I'm now stuck because I don't know who to ping and how... (If anyone reading this, knows, please reply!) |
@FiloSottile are you still the correct / latest assignee for this issue and can you please suggest how to proceed? Or is this information outdated? |
In case of a RSA-PSS algorithm, the hashFunc of CreateCertificateRequest is embedded in a rsa.PSSOptions struct. Given to key.Sign(), this will generate a proper RSA-PSS signature. Pasted from the RSA-PSS handling code in CreateCertificate() Fixes golang#45990
In case of a RSA-PSS algorithm, the hashFunc of CreateCertificateRequest is embedded in a rsa.PSSOptions struct. Given to key.Sign(), this will generate a proper RSA-PSS signature. Pasted from the RSA-PSS handling code in CreateCertificate() Fixes golang#45990
gentle ping |
Change https://go.dev/cl/555595 mentions this issue: |
Issue duplicated by #65074 |
In case of a RSA-PSS algorithm, the hashFunc of CreateCertificateRequest is embedded in a rsa.PSSOptions struct. Given to key.Sign(), this will generate a proper RSA-PSS signature. Pasted from the RSA-PSS handling code in CreateCertificate() Fixes golang#45990
The new issue seemed to have contracted more attention then the old one. |
I've updated my PR description to tell its fixes both issues. |
Change https://go.dev/cl/431916 mentions this issue: |
Change https://go.dev/cl/586015 mentions this issue: |
Centralizing some repetitive code, which would have prevented #45990. This also fixes the deprecated Certificate.CreateCRL for RSA-PSS, not that anyone cared, probably. This has two other minor observable behavior changes: MD2 is now treated as a completely unknown algorithm (why did we even have that!? removing lets us treat hash == 0 as always meaning no prehash); and we now do the signature verification self-check for all signing operations. Change-Id: I3b34fe0c3b6eb6181d2145b0704834225cd45a27 Reviewed-on: https://go-review.googlesource.com/c/go/+/586015 Reviewed-by: Dmitri Shuralyov <[email protected]> Reviewed-by: Roland Shoemaker <[email protected]> Auto-Submit: Filippo Valsorda <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
What version of Go are you using (
go version
)?(Freshly compiled from master)
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I created a RSA-PSS CertificateRequest and tried to check its signature.
Here is a simple test program : https://play.golang.org/p/TGNgUYvNH5o
It can also be reproduced with the tests from
crypto/x509/x509_test.go
:What did you expect to see?
Program should display "OK" and the test should be OK.
What did you see instead?
Program panicked and test failed : csr.CheckSignature() returned an error instead of
nil
which would mean a verified signature.The text was updated successfully, but these errors were encountered: