mirror of
https://github.com/apple/swift-certificates
synced 2026-11-29 05:04:21 +00:00
This change adds support for implementing a `CustomCertificateStore` in a backwards compatible way with minimal impact to performance. A custom certificate store can be implemented, and then the new `CertificateStore(custom:)` constructor can be used so that the custom certificate store can be used interchangeably with a "normal" certificate store. Additionally, a test case verifies that this new protocol will work for our use case. More specifically, the use case we have is for normalization of distinguished names so that an exact match of distinguished names is no longer required. For example, if `printableString` should be used interchangeably with a `utf8String`. This pull request has two commits: - One that adds support for a `CustomCertificateStore` - One that modifies the implementation to support `async` lookup of certificiates. The second change is not required for our use-case, however I would expect that there may be a future use-case that requires looking up certificates in a database, and supporting an `async` protocol would be valuable. Also, the `verify()` method is already async, so supporting an `async` lookup does not disrupt any existing public APIs.