Skip to content

feat: client certificate authentication (mTLS) (#58) - #81

Merged
fmazzant merged 1 commit into
release/1.7.0from
feat/58-client-certificate-authentication
Nov 22, 2026
Merged

fmazzant merged 1 commit into
release/1.7.0from
feat/58-client-certificate-authentication

Conversation

@fmazzant

Copy link
Copy Markdown
Owner

Part of #58

Summary

  • New ClientCertificateRequested event: Host, Port, AcceptableIssuers, AvailableCertificates (Windows store), Certificate (null = continue without), IntermediateCertificates, GetDeferral().
  • Android: OnReceivedClientCertRequest → ClientCertRequest.Proceed with the PKCS#8 key (RSA/EC) and the chain; Ignore() when no certificate.
  • iOS / Mac Catalyst: NSURLAuthenticationMethodClientCertificate → NSUrlCredential from SecIdentity.Import.
  • Windows: CoreWebView2.ClientCertificateRequested; the chosen certificate is matched by thumbprint against MutuallyTrustedCertificates (WebView2 can only send store certificates).
  • Without a handler the platform default applies (Android/iOS continue without a certificate, WebView2 shows its picker).
  • README section "Client certificates" and a row in the comparison table.

Tests

  • Unit tests for issuer name decoding, PEM conversion, thumbprint match and PKCS#8 key export (398 passed).
  • Library builds for android, ios, maccatalyst and windows with no warnings.
  • Not yet tried on devices: to check against https://client.badssl.com/ with the badssl.com client certificate.

…ed (#58)

Add the ClientCertificateRequested event for servers that require a client
certificate (mutual TLS). The app answers with an X509Certificate2 with its
private key (plus optional intermediates), or continues without one; a
deferral allows loading it asynchronously. Without a handler the platform
default applies.

- Android: WebViewClient.OnReceivedClientCertRequest; the key is passed to
  ClientCertRequest.Proceed as PKCS#8 (RSA or EC) with the chain.
- iOS / Mac Catalyst: NSURLAuthenticationMethodClientCertificate challenge
  answered with an NSUrlCredential from a SecIdentity.
- Windows: CoreWebView2.ClientCertificateRequested; the certificate is
  matched by thumbprint against the store certificates the server accepts,
  listed in AvailableCertificates.
- Unit tests for issuer names, the store match and the key export; README
  section.
@fmazzant fmazzant self-assigned this Nov 17, 2026
@fmazzant fmazzant added this to the 1.7.0 milestone Nov 17, 2026
@fmazzant
fmazzant merged commit 9de2aa5 into release/1.7.0 Nov 22, 2026
4 checks passed
@fmazzant
fmazzant deleted the feat/58-client-certificate-authentication branch December 1, 2026 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants