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

go1.20: Replace crypto/elliptic with crypto/ecdh where possible #6552

Closed
aarongable opened this issue Dec 14, 2022 · 1 comment
Closed

go1.20: Replace crypto/elliptic with crypto/ecdh where possible #6552

aarongable opened this issue Dec 14, 2022 · 1 comment

Comments

@aarongable
Copy link
Contributor

As of go1.20, the go stdlib now includes a crypto/ecdh package which is designed to provide a safer way to use elliptic-curve cryptography.

Once we're 100% using go1.20 or above, we should go through and replace as many instances of crypto/elliptic as we can.

@aarongable aarongable changed the title Replace crypto/elliptic with crypto/ecdh where possible go1.20: Replace crypto/elliptic with crypto/ecdh where possible Dec 14, 2022
@aarongable
Copy link
Contributor Author

It turns out the "where possible" portion of this bug is "nowhere".

Our two main uses for the crypto/elliptic library are:

  1. Passing elliptic.P256() as an argument to ecdsa.GenerateKey(), such as here:
    lintSigner, err = ecdsa.GenerateKey(k.Curve, rand.Reader)

    This functionality cannot be replicated with the new ecdh.P256().GenerateKey(), because that produces an ecdh.PrivateKey which cannot be converted to an ecdsa.PrivateKey.
  2. Using elliptic.Unmarshal() to convert raw bytes into a point on a curve, such as here:
    x, y := elliptic.Unmarshal(pubKey.Curve, pointBytes)

    This functionality cannot be replicated with the new ecdh.Curve.NewPublicKey(), for the same reason as above.

Therefore I am closing this bug as WontFix, unfortunately.

@aarongable aarongable closed this as not planned Won't fix, can't repro, duplicate, stale Feb 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant