Adding feature to allow a callable as the signing key #10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I made modifications to the CertificateBuilder.build to allow for a callable to be used as the private key. This will allow downstream usage of a key that leverages an external process or custom code to calculate the signature while maintaining the core functionality of assembling the x509 certificate.
Example usage:
test_callable_key.py
I tried to figure out how to verify that the signature is valid, but couldn't find a way to test it that was super complicated.
While the example is mostly pointless, this feature could be useful when attempting to use a key maintained in an external key store, such as with a hardware security module (HSM), AWS KMS, or other key signing service.
I initially asked if this was possible in pyca/cryptography#5921, which I found to be extremely difficult to try to build in.
Thanks for your consideration!