clientCertificate property

  1. @override
X509Certificate? get clientCertificate
override

The certificate that the client presented in the TLS handshake of this request's connection (mutual TLS), or null if it presented none.

A server only asks for one if it was started with requestClientCertificate: true, as by AngelHttp.fromSecurityContext or AngelHttp2. The certificate has been verified against the trusted certificates of the server's SecurityContext, as by setClientAuthorities or setTrustedCertificates; a client whose certificate does not verify fails the handshake, and never reaches the app. A context that trusts more than the CAs of your clients, such as one of withTrustedRoots: true, accepts any certificate that they sign, so check the certificate's issuer or subject as well.

Behind a reverse proxy that terminates TLS, this is null: the certificate, if any, is of the proxy's connection to the client.

null for a request of no TLS connection, as of a test or a driver that does not know one.

Implementation

@override
X509Certificate? get clientCertificate => _clientCertificate;