ecdsa: refactor signature types into Signature + asn1::Document #98
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.
The previous implementation had
Asn1SignatureandFixedSignaturetypes which sat side-by-side as equals.However, that's annoying, because it means we need to do various work in duplicate for both signature types.
It's also annoying because there's no "one true signature type" to reach for.
The original motivations for doing this were a few different things:
Now that we have bidirectional transcoding between the formats, and particularly one which should always serialize to "strict DER", it seems like it's probably worth it to pay the transcoding costs and "standardize" on the previous
FixedSignatureformat as the blessedecdsa::Signaturetype.This allows factoring everything ASN.1 related (besides a few helper methods and a From-impl on Signature) into the
ecdsa::asn1module which everything else aside just feels cleaner than before.This also means downstream ECDSA provider crates don't need to worry about ASN.1 at all (unless they're e.g. parsing it from HSM/KMS output) and can focus exclusively on the
ecdsa::Signaturetype.