Skip to content
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

x/crypto/openpgp: pointer usage for rsa.PublicKey is inconsistent with crypto/x509 #27606

Closed
mattmoyer opened this issue Sep 10, 2018 · 2 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@mattmoyer
Copy link

mattmoyer commented Sep 10, 2018

What version of Go are you using (go version)?

go version go1.11 darwin/amd64

Also golang/crypto@0e37d00.

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOOS="darwin"

What did you do?

I wrote some code which implements crypto.Signer. My original use case for this was to plug into golang.org/x/crypto/openpgp so I can perform PGP signatures using my signer. To do this, I had to make my PublicKey() method return a rsa.PublicKey (no pointer) so I can pass the type check in NewSignerPrivateKey().

So far, so good.

What did you expect to see?

I expected my crypto.Signer implementation to work, without changes, with crypto/x509.

What did you see instead?

crypto/x509 also has a type check, but it checks for *rsa.PublicKey (pointer) rather than rsa.PublicKey.

It doesn't seem that I can implement one crypto.Signer that will work with both golang.org/x/crypto/openpgp and crypto/x509. I think we can fix this and keep backwards compatibility by extending the the type check in golang.org/x/crypto/openpgp 's NewSignerPrivateKey() to treat *rsa.PublicKey the same as rsa.PublicKey.

Thanks to @joemiller for originally reporting this downstream (vmware-archive/google-kms-pgp#2).

@gopherbot
Copy link

Change https://golang.org/cl/137895 mentions this issue: openpgp: allow RSA signers to return a pointer

@Merovius
Copy link
Contributor

I ran into the same issue. Sorry for jumping the gun, but I didn't see this issue until after I already had the CL prepared :)

@FiloSottile FiloSottile added the NeedsFix The path to resolution is known, but the work has not been done. label Sep 27, 2018
@golang golang locked and limited conversation to collaborators Oct 1, 2019
chintanparikh pushed a commit to opendoor-labs/openpgp that referenced this issue Dec 11, 2019
Fixes golang/go#27606

Change-Id: I88b2f7c7796b43449a17a6be963c05f741dbf904
Reviewed-on: https://go-review.googlesource.com/137895
Reviewed-by: Filippo Valsorda <filippo@golang.org>
c-expert-zigbee pushed a commit to c-expert-zigbee/crypto_go that referenced this issue Mar 28, 2022
Fixes golang/go#27606

Change-Id: I88b2f7c7796b43449a17a6be963c05f741dbf904
Reviewed-on: https://go-review.googlesource.com/137895
Reviewed-by: Filippo Valsorda <filippo@golang.org>
c-expert-zigbee pushed a commit to c-expert-zigbee/crypto_go that referenced this issue Mar 29, 2022
Fixes golang/go#27606

Change-Id: I88b2f7c7796b43449a17a6be963c05f741dbf904
Reviewed-on: https://go-review.googlesource.com/137895
Reviewed-by: Filippo Valsorda <filippo@golang.org>
c-expert-zigbee pushed a commit to c-expert-zigbee/crypto_go that referenced this issue Mar 29, 2022
Fixes golang/go#27606

Change-Id: I88b2f7c7796b43449a17a6be963c05f741dbf904
Reviewed-on: https://go-review.googlesource.com/137895
Reviewed-by: Filippo Valsorda <filippo@golang.org>
LewiGoddard pushed a commit to LewiGoddard/crypto that referenced this issue Feb 16, 2023
Fixes golang/go#27606

Change-Id: I88b2f7c7796b43449a17a6be963c05f741dbf904
Reviewed-on: https://go-review.googlesource.com/137895
Reviewed-by: Filippo Valsorda <filippo@golang.org>
BiiChris pushed a commit to BiiChris/crypto that referenced this issue Sep 15, 2023
Fixes golang/go#27606

Change-Id: I88b2f7c7796b43449a17a6be963c05f741dbf904
Reviewed-on: https://go-review.googlesource.com/137895
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants