You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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
anded25519.PrivateKey
(not a pointer).I copied the latter assumptions from the package
x509
(for instance functionMarshalPKCS8PrivateKey
), looks like it is being a convention in the Go standard libraries to pass arounded25519.PrivateKey
anded25519.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 .
)The text was updated successfully, but these errors were encountered: