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

crypto/elliptic: document what the "canonical names" for curves are #34193

Open
mdempsky opened this issue Sep 9, 2019 · 0 comments

Comments

@mdempsky
Copy link
Member

commented Sep 9, 2019

I needed to write code to distinguish whether a pk *ecdsa.PublicKey refers to a point on P-256, P-384, P-521, or some other curve. It looks like the proper way to do this is to switch on pk.Curve().Name, which provides "the canonical name of the curve". (Aside: If this is not the best way to do this, please let me know.)

However, I'm aware of many possible "canonical" names for P-256; for example, "P256" (the package elliptic function name), "P-256" (what package elliptic's documentation calls it), "Curve P-256" (what FIPS 186-3 calls it), "NIST P256" (what the TCG Algorithm Registry calls it), "prime256v1" (what RFC 3279 calls it), "secp256r1" (what RFC 5480 calls it), "nistp256" (what RFC 5656 calls it), etc.

I had to inspect package elliptic's source to figure out what to expect pk.Curve().Name to return.

/cc @agl @FiloSottile

@FiloSottile FiloSottile added the NeedsFix label Sep 9, 2019

@FiloSottile FiloSottile added this to the Go1.14 milestone Sep 9, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.