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/x509: better documentation for ParsePKIXPublicKey #14355

Closed
dndx opened this issue Feb 17, 2016 · 2 comments
Closed

crypto/x509: better documentation for ParsePKIXPublicKey #14355

dndx opened this issue Feb 17, 2016 · 2 comments
Milestone

Comments

@dndx
Copy link
Contributor

dndx commented Feb 17, 2016

In the latest Golang release (1.5.3), the documentation for x509.ParsePKIXPublicKey() says the function takes in a []byte of DER encoded public key and returns pub interface{}. It is not obvious exactly what pub is or how to use it unless digging inside the source code and trace to the function parsePublicKey().

Suggested changes:

  • Mention explicitly what kind of public key input we support (RSA, DSA, ECDSA)
  • Mention the type of pub in those three cases respectively
  • Add a short example on how to use switch statement along with type assertions to obtain the correct type of public key.

I will be happy to make those improvements to the document and submit for code review if no objections from the project maintainers.

@ianlancetaylor ianlancetaylor changed the title doc: crypto/x509: Better documentation for ParsePKIXPublicKey() crypto/x509: better documentation for ParsePKIXPublicKey Feb 17, 2016
@ianlancetaylor ianlancetaylor added this to the Go1.7 milestone Feb 17, 2016
@ianlancetaylor
Copy link
Contributor

Sure, send a CL. Thanks.

An example should probably go in example_test.go.

@gopherbot
Copy link

CL https://golang.org/cl/19757 mentions this issue.

@golang golang locked and limited conversation to collaborators Feb 28, 2017
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

3 participants