golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
122.93k stars 17.52k forks source link

crytpo/x509: MarshalPKCS8PrivateKey doc erraneously says ecdsa.PublicKey instead of ecdsa.PrivateKey #24413

Closed golangdaddy closed 6 years ago

golangdaddy commented 6 years ago

Documentation error for x509.MarshalPKCS8PrivateKey...

Docs say this will marshal ecdsa.PublicKey but the author obviously meant ecdsa.PrivateKey.

ecdsa.PublicKey does not marshal:

x509: unknown key type while marshalling PKCS#8: *ecdsa.PublicKey

gopherbot commented 6 years ago

Change https://golang.org/cl/100839 mentions this issue: crypto/x509: clarify accepted keys for MarshalPKCS8PrivateKey

adamdecaf commented 6 years ago

Thanks for catching that!