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

Feature request: Support to wrap pre-created RSA, ECDSA or Ed25519 keys #202

Open
balena opened this issue Mar 10, 2024 · 0 comments
Open

Comments

@balena
Copy link

balena commented Mar 10, 2024

Context

There are use cases where keys are pre-created. For example, on environments where key derivations are required.

The function NewEntity can only be used to create keys from scratch based on parameters passed on the config, and does not allow passing pre-created keys.

Solution

In the PR #201, I've created a new function NewEntityFromKey so that users can pass pre-created keys of types *rsa.PrivateKey, *ecdsa.PrivateKey and ed25519.PrivateKey (not a pointer).

I copied the latter assumptions from the package x509 (for instance function MarshalPKCS8PrivateKey), looks like it is being a convention in the Go standard libraries to pass around ed25519.PrivateKey and ed25519.PublicKey keys without pointers.

This is a proof the entity created from passed keys works with gpg: https://gist.github.com/balena/27ef6b7ca319cd43f0d2d9ff2af49248
(run with go test -v -count=1 .)

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

No branches or pull requests

1 participant