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

NewSignatureData works with generic crypto signer. #420

Merged
merged 2 commits into from
Sep 15, 2024

Conversation

werwurm
Copy link
Contributor

@werwurm werwurm commented Sep 6, 2024

Casting the crypto.Signer into concrete crypto.PrivateKey
implementations unnecessarily limits the use of the library to software
implementations provided by the golang crypto libraries.

This patch makes the detection of the algorithm based on the public key
which is exposed through crypto.Signer.Public() and then uses the
interface function Sign to perform the actual signing.

This allows for hiding the implementation behind the crypto.Signer
interface, e.g., for signing with an HSM backed key.

Caveat: This patch does not add support for generic SM2 implementations.
But this is not a regression.

Signed-of-by: Janis Danisevskis [email protected]

Casting the crypto.Signer into concrete crypto.PrivateKey
implementations unnecessarily limits the use of the library to software
implementations provided by the golang crypto libraries.

This patch makes the detection of the algorithm based on the public key
which is exposed through crypto.Signer.Public() and then uses the
interface function Sign to perform the actual signing.

This allow for hiding the implementation behind the crypto.Signer
interface, e.g., for signing with an HSM backed key.

Caveat: This patch does not add support for generic SM2 implementations.
But this is not a regression.

Signed-off-by: Janis Danisevskis <[email protected]>
@werwurm
Copy link
Contributor Author

werwurm commented Sep 9, 2024

The clean-code error does not seam to be related to my PR. There seems to be an error while installing one of the checks?

@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 41.63%. Comparing base (ef43a2a) to head (dd81760).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #420   +/-   ##
=======================================
  Coverage   41.63%   41.63%           
=======================================
  Files         142      142           
  Lines       10729    10729           
=======================================
  Hits         4467     4467           
  Misses       5394     5394           
  Partials      868      868           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rminnich rminnich merged commit 923daa8 into linuxboot:main Sep 15, 2024
6 of 7 checks passed
@orangecms
Copy link
Collaborator

The clean-code error does not seam to be related to my PR. There seems to be an error while installing one of the checks?

Yes, #423 fixed part of the CI issues. Thank you!

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 this pull request may close these issues.

4 participants