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 proposal #18

Open
poolpOrg opened this issue May 11, 2023 · 1 comment
Open

feature proposal #18

poolpOrg opened this issue May 11, 2023 · 1 comment

Comments

@poolpOrg
Copy link

hellow @jbowes,

For my own uses, I have experimented with a change which I'd like to know if you're interested in before I spend more time on it for a proper PR.

Long story short, whenever you want to add support for a specific elliptic curve and a specific hasher function, you are forced to implement a specific private signer & verifier, as well as a specific public signer & verifier functions (ie: signEcdsaP256Sha256, verifyEcdsaP256Sha256, WithSignEcdsaP256Sha256, WithVerifyEcdsaP256Sha256).

I implemented WithSignEcdsa(), WithVerifyEcdsa, signEcdsa & verifyEcdsa which take an additional crypto.Hash parameter and use key.Curve.Params().Name and crypto.Hash.String() to infer the algorithm. With this, I could easily switch between curves and hash functions to support combinations that are currently unsupported in your package.

Is this something you'd be interested in ?

@jbowes
Copy link
Owner

jbowes commented Jun 14, 2023

hi!

yes, i am interested. My intent was to have builtin implementations for the default combinations in the spec's registry, but then allow for arbitrary signing/verification outside of the default registry.

so something like: ```go

type Signer interface {
Sign(in io.Reader) ([]byte, error)
}

func WithSigner(alg string, signer Signer) signatureOption

(and the same for verifier) seems about right to me. Then consumers would be responsible for bundling up pre-hashing and signing/verifying into a single interface.

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

2 participants