SslPinningClient class
Creates SecurityContext and HttpClient with pinned certificates.
- Local (recommended): createContext / createHttpClient load bundled certificates, plain or encrypted.
- Remote: downloadCertificate fetches the certificate from your endpoint and always replaces the stored copy; then createRemoteContext / createRemoteHttpClient build pinned clients synchronously from it.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
-
debugFetchOverride
↔ Future<
Uint8List> Function(RemoteCertificateConfig config)? -
Override for the download request in tests.
getter/setter pair
Static Methods
-
cachedPem(
SslPinningConfig config) → Uint8List? -
Resolved PEM bytes for a local
config, ornullif it hasn't been initialized yet. Forward to the reporter'spinnedCertPemto reuse the same cert without a second load. -
cachedRemotePem(
RemoteCertificateConfig config) → Uint8List? -
Resolved PEM bytes for a remote
config, ornullif downloadCertificate hasn't succeeded yet. -
clearRemoteCertificate(
RemoteCertificateConfig config) → Future< void> -
Removes the stored remote certificate for
configand evicts it from the memory cache. -
createContext(
SslPinningConfig config, {AssetBundle? bundle}) → Future< SecurityContext> -
Builds a SecurityContext pinned to the local certificates in
config, plain PEM or encrypted.enc(withpassphrase). -
createHttpClient(
SslPinningConfig config, {AssetBundle? bundle}) → Future< HttpClient> - createContext wrapped in an HttpClient.
-
createRemoteContext(
RemoteCertificateConfig config) → SecurityContext - Synchronously builds a SecurityContext pinned to the certificate previously obtained with downloadCertificate.
-
createRemoteHttpClient(
RemoteCertificateConfig config) → HttpClient - createRemoteContext wrapped in an HttpClient.
-
downloadCertificate(
RemoteCertificateConfig config) → Future< bool> -
Downloads the certificate from RemoteCertificateConfig.url,
validates it (plain or encrypted, per
passphrase), and always replaces the stored copy. -
invalidateCache(
) → void - Clears every in-memory context and PEM. Stored remote certificates are kept; use clearRemoteCertificate to delete them.
-
validatePem(
Uint8List bytes) → void