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

Eliminate redundant crypto.SignerOpts argument #2635

Open
ibukanov opened this issue Aug 7, 2024 · 0 comments
Open

Eliminate redundant crypto.SignerOpts argument #2635

ibukanov opened this issue Aug 7, 2024 · 0 comments

Comments

@ibukanov
Copy link
Collaborator

ibukanov commented Aug 7, 2024

Presently various methods in httpsignature take crypto.SignerOpts argument. The reason for that is that the code eventually calls the Sign() method of the Singnator interface. The signature of that method is derived from https://pkg.go.dev/crypto/ed25519#PrivateKey.Sign. However, for all relevant implementations of the Signer (ED25519/HMAC/Nitro) that argument is not used or should be crypto.Hash(0). As a result the code needs to pass crypto.Hash(0) in quite a few places where the signing is requred.

The same happens with the Verify method.

It will be nice to change the interface to avoid taking useless arguments and pass crypto.Hash(0) only once where a particular implementation requires that.

ibukanov added a commit that referenced this issue Aug 7, 2024
Eliminate io.Reader and crypto.SignerOpts arguments from the
Signator/Verifier interfaces to avoid the need to pass crypto.hash(0) in
multiple places.

For symmetry with httpsignature.Ed25519PubKey add Ed25519PrivKey wrapper
for ed25519.PrivateKey that implements the updated Verifier interface.
In addition the wrapper provides Public() and PublicHex() methods to
simplify the common operations.

Close #2635
ibukanov added a commit that referenced this issue Aug 7, 2024
Eliminate io.Reader and crypto.SignerOpts arguments from the
Signator/Verifier interfaces to avoid the need to pass crypto.hash(0) in
multiple places.

For symmetry with httpsignature.Ed25519PubKey add Ed25519PrivKey wrapper
for ed25519.PrivateKey that implements the updated Verifier interface.
In addition the wrapper provides Public() and PublicHex() methods to
simplify the common operations.

Close #2635
ibukanov added a commit that referenced this issue Aug 7, 2024
Eliminate io.Reader and crypto.SignerOpts arguments from the
Signator/Verifier interfaces to avoid the need to pass crypto.hash(0) in
multiple places.

For symmetry with httpsignature.Ed25519PubKey add Ed25519PrivKey wrapper
for ed25519.PrivateKey that implements the updated Verifier interface.
In addition the wrapper provides Public() and PublicHex() methods to
simplify the common operations.

Close #2635
ibukanov added a commit that referenced this issue Aug 7, 2024
Eliminate io.Reader and crypto.SignerOpts arguments from the
Signator/Verifier interfaces to avoid the need to pass crypto.hash(0) in
multiple places.

For symmetry with httpsignature.Ed25519PubKey add Ed25519PrivKey wrapper
for ed25519.PrivateKey that implements the updated Verifier interface.
In addition the wrapper provides Public() and PublicHex() methods to
simplify the common operations.

Close #2635
ibukanov added a commit that referenced this issue Aug 7, 2024
Eliminate io.Reader and crypto.SignerOpts arguments from the
Signator/Verifier interfaces to avoid the need to pass crypto.hash(0) in
multiple places.

For symmetry with httpsignature.Ed25519PubKey add Ed25519PrivKey wrapper
for ed25519.PrivateKey that implements the updated Verifier interface.
In addition the wrapper provides Public() and PublicHex() methods to
simplify the common operations.

Close #2635
ibukanov added a commit that referenced this issue Aug 7, 2024
Eliminate io.Reader and crypto.SignerOpts arguments from the
Signator/Verifier interfaces to avoid the need to pass crypto.hash(0) in
multiple places.

For symmetry with httpsignature.Ed25519PubKey add Ed25519PrivKey wrapper
for ed25519.PrivateKey that implements the updated Verifier interface.
In addition the wrapper provides Public() and PublicHex() methods to
simplify the common operations.

Close #2635
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 a pull request may close this issue.

1 participant