When we decode a certificate, we produce an in-memory representation.
This representation is something we are capable of encoding. If we
re-encode that directly, we can produce an output that is different to
the one we injested. This happens when there are objects that can be
canonicalised, such as replacing an explicit ASN1 NULL with an absent
field where both are considered equivalent.
This patch rewrites the code to ensure that we preserve the bytes of the
certificate that we deserialized. This allows us to write them back
unchanged, ensuring that certificates can round-trip through this
library without modification.
A side-effect of this change is that we need to essentially encode the
certificate on construction whenever we build them in memory. That's not
a big deal, but it is a bit of an annoyance.
This is the first of a series of PRs that adds support for RFC 5280
policies as a single verifier policy. For now we take the low hanging
fruit, expiry.
This patch adds support for basic CMS operations. We aren't sure that
the API surface here is right, so for now we're going to provide this
under an SPI guard so that we can make any amendments we might need.
When building against a build tree artifact for Foundation, we need to add the build tree artifacts of dispatch as that is an exposed dependency for Foundation.
Motivation
We omitted RSA signing in the initial implementation. We should support
it.
As part of this, we need to decouple the idea that we know what the
digest algorithm is based solely on the key type. There's no particular
reason not to support ECDSA with SHA256 when using a P521 key, so we
need to tolerate that as well.
Modifications
- Explicitly pass the signature algorithm to our various cryptographic
operations.
- Add a Digest type to handle the various digest types we create.
- Add tests for the various cross products.
Results
RSA signing works, as do weirder flavours of ECDSA.