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: Create typed versions of ParsePKCS8PrivateKey #26485

Open
HaraldNordgren opened this Issue Jul 19, 2018 · 5 comments

Comments

Projects
None yet
4 participants
@HaraldNordgren
Member

HaraldNordgren commented Jul 19, 2018

It bothers me that me as an end-user of ParsePKCS8PrivateKey have to do type assertion logic on the key even when you know what you expect.

We should utilize Go's strong type system to create type-specific functions called for example

  • ParsePKCS8PrivateKeyRSA(der []byte) (key *rsa.PrivateKey, err error)
  • ParsePKCS8PrivateKeyECDSA(der []byte) (key *ecdsa.PrivateKey, err error)
@gopherbot

This comment has been minimized.

gopherbot commented Jul 19, 2018

Change https://golang.org/cl/125056 mentions this issue: crypto/x509: create typed versions of ParsePKCS8PrivateKey

@bcmills

This comment has been minimized.

Member

bcmills commented Jul 19, 2018

@bcmills bcmills added this to the Go1.12 milestone Jul 19, 2018

@HaraldNordgren

This comment has been minimized.

Member

HaraldNordgren commented Aug 6, 2018

Tagging som people who might be interested in discussing this 😃

@adamdecaf
@agl
@bradfitz
@ianlancetaylor
@martisch
@rsc
@thsnr

@adamdecaf

This comment has been minimized.

Contributor

adamdecaf commented Aug 11, 2018

I'm indifferent, but adding new methods adds to the overall api surface, which has its own problems with maintenance.

@adamdecaf

This comment has been minimized.

Contributor

adamdecaf commented Aug 11, 2018

@gopherbot proposal-crypto

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment