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: use rsa.PublicKey as a pointer #27884

Closed
Merovius opened this issue Sep 26, 2018 · 1 comment
Closed

x/crypto/openpgp: use rsa.PublicKey as a pointer #27884

Merovius opened this issue Sep 26, 2018 · 1 comment

Comments

@Merovius
Copy link
Contributor

In NewSignerPrivateKey, the type-switch contains a rsa.PublicKey. Which is unfortunate, because it means you can't pass e.g. an *rsa.PublicKey as signer, as that returns a pointer. It's also inconsistent with other parts of the package - for example, the PrivateKey struct itself documents it as being a pointer. This probably slipped through review, because ecdsa.PublicKey is used as a value (it's a slice).

It would probably be better to use a pointer in the type-switch to stay consistent. Unfortunately, that would be a breaking change. I found at least one client depending on the current behavior, though they're quite new and might be willing to switch.

A backwards-compatible way to deal with it would be to add a case for a pointer to the type-switch. Personally, I find that ugly, but it's not hard, stays compatible and apart from the ugliness, I don't think there's any downside to it. I have a CL for this, but wanted to create an issue too, to link to.

@gopherbot gopherbot added this to the Unreleased milestone Sep 26, 2018
@Merovius
Copy link
Contributor Author

Ah, dup of #27606, closing this one.

@golang golang locked and limited conversation to collaborators Sep 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants