Make signing_cert
optional for most of the signing process
#141
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.
Description of the changes
This is an internal plumbing change that makes the signature preparation process less reliant on the
signing_cert
attribute in theSigner
hierarchy. In other words, provided you're willing to go without some conveniences, you can now prepare documents for signing without having access to the signer's certificate ahead of time. This is mostly relevant for the interrupted signing workflow, more specifically in scenarios involving remote signing services that supply CMS objects containing short-lived certificates that are generated on-the-fly after the request is submitted.This has come up often in the past, with issues going back as far as #3, but also #31, #90 and #103.
Caveats
Some of the things that pyHanko usually does automatically will no longer work in the absence of a signer's certificate. These include the following:
Also note that, in practice, you still need a signer's certificate to assemble a working CMS
SignedData
container. As such, built-in signers likeSimpleSigner
andPKCS11Signer
will keep thesigning_cert
requirement.ExternalSigner
, which is largely a dummy implementation for use with the interrupted signing workflow, does acceptNone
for the signer's certificate.Checklist
Please go over this checklist to increase the chances of your PR being worked on in a timely manner. Deviations are allowed with proper justification (see previous section).
For new features (delete if not applicable)