apple / swift-nio-ssl

TLS Support for SwiftNIO, based on BoringSSL.
https://swiftpackageindex.com/apple/swift-nio-ssl/main/documentation/niossl
Apache License 2.0
392 stars 142 forks source link

support additional certificate validation #361

Closed dnadoba closed 2 years ago

dnadoba commented 2 years ago

Motivation

A user should be able to inspect a certificate chain after default verification and accept or reject that connection asynchronously. We do not yet have access to the complete verified certificate chain in SwiftNIO SSL but we can already prepare the state machine in NIOSSLHandler to support an additional verification step.

Modification

Result

NIOSSLHandler supports an asynchronous user defined verification step after default verification that delays connection establishment until success. Everything is still internal as we will need to alter the type signature of NIOSSLContext. CertificateChainVerificationCallback once we have access to the verified certificate chain.