-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Description
Apologies for not following the template, it did not seem relevant since my issue is with the documentation of crypto/x509
as it currently shows on https://pkg.go.dev/crypto/x509#ParsePKCS8PrivateKey. I also did not open this issue as a pkg.go.dev bug since it's an issue with the package's documentation, not the documentation website itself. If either decision was incorrect please let me know and I'll correct them.
The documentation for x509.ParsePKCS8PrivateKey
mentions the possible return types of the function as:
It returns a *rsa.PrivateKey, a *ecdsa.PrivateKey, a ed25519.PrivateKey (not a pointer), or a *ecdh.PublicKey (for X25519).
However, in the case of X25519, the actual implementation returns a *ecdh.PrivateKey
(ref), which makes more sense, and also fits with what types x509.MarshalPKCS8PrivateKey
is documented to accept for the key
parameter.
Therefore it looks to me like the documentation is incorrect, and should instead be:
It returns a *rsa.PrivateKey, a *ecdsa.PrivateKey, a ed25519.PrivateKey (not a pointer), or a *ecdh.PrivateKey (for X25519).