Motivation:
There is a possible overflow when computing a `Double` value for `fractionalSeconds` from an `ArraySlice` of bytes. Hence, access to this original `ArraySlice` is necessary.
Modifications:
- Add `rawFractionalSeconds` property to `GeneralizedTime`.
- Add a new `internal init` to `GeneralizedTime` that accepts `rawFractionalSeconds` instead of `fractionalSeconds` and generates the later from the former.
- Adjust the algorithm for computing `fractionalSeconds`, from a mathematical to a `String` computation. This is due to the precision mismatch between the mathematical computation and the native `Double` computation. This issue, which previously did not surface, now does, due to the newly included round-trip conversion from `fractionalSeconds` to `rawFractionalSeconds`.
Result:
- The `rawFractionalSeconds` property now provides the original `ArraySlice` from which `fractionalSeconds` was computed.
- `GeneralizedTime` can now compute `fractionalSeconds` from the provided `rawFractionalSeconds`.
* Support macOS 10.14.x/iOS 12.x and older again
* Revert "Support macOS 10.14.x/iOS 12.x and older again"
This reverts commit 6eeba0327f.
* Erase concrete type manually
### Motiviation
We want reduce allocations in swift-certificates and need a way to parse without allocating an intermediate `Array`.
### Modifications
add `DER.lazySet(of:identifier:rootNode)` which returns its result without allocating.
### Result
We can eliminate allocations during parsing
While this is a nice clear construction, it also has to allocate a temporary
Array, as the StrideTo type is not a BidirectionalCollection but a Sequence.
In rare cases it's necessary for users to be able to do an end-run
around the serializer. This is most common in cases where some bytes
have had a signature calculated over them, and they are being
re-encoded. Even though DER is unambiguous, the ASN.1 objects themselves
may not be, and may permit multiple valid encodings. Allowing the bytes
to be re-serialized as they were preserves the integrity of the
signature.
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.