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

Add API for using crypto.Signer with SigningContext #89

Merged

Conversation

mdwn
Copy link
Contributor

@mdwn mdwn commented Mar 6, 2023

The main purpose of the pull request adds a crypto.Signer to SigningContext to enable signing by an HSM. This change also enables signing with ECDSA keypairs.

  • Added NewSigningContext to construct a SigningContext that holds a crypto.Signer and the certificate chain and is mutually exclusive with X509KeyStore
  • If the SigningContext has a non-nil KeyStore, it uses that instead to maintain backwards compatibility and not break existing code.
  • Use x509.Certificate's CheckSignature method instead of the RSA public key to support validation of ECDSA signatures
  • Added constants and changed the maps slightly to support ECDSA signature methods.

Note: This is just a slightly updated version of https://github.com/russellhaering/goxmldsig/pull/44/files. Full credit deserves to go to @charredlot.

The main purpose of the pull request adds a `crypto.Signer` to `SigningContext`
to enable signing by an HSM. This change also enables signing with ECDSA
keypairs.

* Added `NewSigningContext` to construct a `SigningContext` that holds a
  `crypto.Signer` and the certificate chain and is mutually exclusive with
  `X509KeyStore`
* If the `SigningContext` has a non-nil `KeyStore`, it uses that instead to
  maintain backwards compatibility and not break existing code.
* Use `x509.Certificate`'s `CheckSignature` method instead of the RSA public
  key to support validation of ECDSA signatures
* Added constants and changed the maps slightly to support ECDSA signature
  methods.

Co-authored-by: charredlot <[email protected]>
@mdwn mdwn force-pushed the mike.wilson/support-crypto-signer branch from 06597d9 to dcbd738 Compare March 6, 2023 18:31
@russellhaering
Copy link
Owner

Looks good, thanks to both of you for taking this on!

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.

2 participants