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.
In the latest Golang release (1.5.3), the documentation for x509.ParsePKIXPublicKey() says the function takes in a
[]byteof DER encoded public key and returnspub interface{}. It is not obvious exactly whatpubis or how to use it unless digging inside the source code and trace to the functionparsePublicKey().Suggested changes:
pubin those three cases respectivelyswitchstatement 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.