s2n-tls
s2n-tls copied to clipboard
feat(bindings): expose cert validation callback
Release Summary:
Add rust binding for s2n_cert_validation_callback
Resolved issues:
resolves #5264
Description of changes:
s2n_cert_validation_callback is an unstable async callback that operates on the struct s2n_cert_validation_info. To expose its rust binding, I utilized the existing AsyncCallback struct and made the following changes:
- Added a new module
cert_validation.rsand gated behindfeature = "unstable-crl". - Wrapped
s2n_cert_validation_infoin a Rust structCertValidationInfoand implementedaccept()andreject()methods corresponding to the C APIs. - Defined the trait
CertValidationCallbackand added a config APIset_cert_validation_callback(). - Tested the callback in synchronous and async use cases.
Testing:
- Implemented
CertValidationCallbackfor bothSyncCallbackandAsyncCallback. -
AsyncCallbackreturns a structAsyncFuturethat implementsConnectionFutureand will execute the async validation. Application specific context can be store on Connection viaset_application_context().
I ran the tests locally and confirmed they both passed:
$ cargo test --features unstable-crl
...
test cert_validation::tests::async_cert_validation ... ok
test cert_validation::tests::sync_cert_validation ... ok
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.