s2n-tls icon indicating copy to clipboard operation
s2n-tls copied to clipboard

feat(bindings): expose cert validation callback

Open CarolYeh910 opened this issue 7 months ago • 0 comments

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:

  1. Added a new module cert_validation.rs and gated behind feature = "unstable-crl".
  2. Wrapped s2n_cert_validation_info in a Rust struct CertValidationInfo and implemented accept() and reject() methods corresponding to the C APIs.
  3. Defined the trait CertValidationCallback and added a config API set_cert_validation_callback().
  4. Tested the callback in synchronous and async use cases.

Testing:

  • Implemented CertValidationCallback for both SyncCallback and AsyncCallback.
  • AsyncCallback returns a struct AsyncFuture that implements ConnectionFuture and will execute the async validation. Application specific context can be store on Connection via set_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.

CarolYeh910 avatar Jun 13 '25 21:06 CarolYeh910