Extend certificate functions to handle non-RSA keys + add support for ed25519 keys #270
+336
−42
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR:
adds support for Ed25519 keys in theNote: This has been removed because it fails the go1.12 CI tests. While Ed25519 support is available in Go 1.12 viagenPrivateKey
function.golang.org/x/crypto/ed25519
, thex509.MarshalPKCS8PrivateKey
does not support ed25519 keys and implementing it manually is reasonably complex. Before I do this, I would like to clarify whether the Go 1.12 tests are relevant at all given that thego.mod
file actually specifies a minimum Go version of 1.13.buildCustomCert
function (in line with what Go supports, ECDSA and Ed25519 keys instead of just RSA keys)...WithKey
variants for thegenCA
,genSignedCert
,genSelfSignedCert
functions, that take as an additional parameter a PEM-encoded private key (any private key generated withgenPrivateKey
and an algorithm other than"dsa"
works) to be used for the certificategenCA
,genSignedCert
, andgenSelfSignedCert
functions use 2048-bit RSA keys.The main motivation is to allow generating certificates with ECDSA or Ed25519 keys, which are much faster both in terms of key usage at runtime, as well as key generation time.