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

Add support for ECC to the pkix package #130

Merged
merged 3 commits into from
Dec 2, 2021
Merged

Conversation

jdtw
Copy link
Contributor

@jdtw jdtw commented Nov 30, 2021

This PR adds support for creating, importing, and exporting ECDSA/Ed25519 keys to the pkix package. Commandline options will be added to certstrap to expose this functionality in a followup PR[1].

Since the standard library doesn't support encrypted PKCS8[2], we take a dependency on the pemutil[3] package to do this encryption/decryption for us.

All RSA operations continue to use PKCS1 for backwards compatibility.

[1] WIP at #128
[2] golang/go#8860 (comment)
[3] https://pkg.go.dev/go.step.sm/crypto/pemutil

@jdtw jdtw marked this pull request as ready for review December 1, 2021 19:48
}
signer = priv
case encryptedPKCS8PrivateKeyPEMBLockType:
b, err := pemutil.DecryptPKCS8PrivateKey(pemBlock.Bytes, password)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this something we need this 3p library for? (so nothing in stdlib or x/crypto that we can use?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately not, see this discussion: golang/go#8860 (comment)

That thread is where I found this package, which looks like it may get considered for inclusion into x/crypto.

@jdtw jdtw merged commit 6b3ab22 into master Dec 2, 2021
@jdtw jdtw deleted the jwood/ecc-primitives branch December 2, 2021 17:07
jdtw added a commit that referenced this pull request Dec 2, 2021
* master:
  Add support for ECC to the pkix package (#130)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants