The object containing the certificates to trust when making a secure client connection, and the certificate chain and private key to serve from a secure server.
The SecureSocket and SecureServer
classes take a SecurityContext
as an argument to their connect and bind methods.
Certificates and keys can be added to a SecurityContext from either PEM or PKCS12 containers.
usePrivateKey, setTrustedCertificates, useCertificateChain, and setClientAuthorities are deprecated. They have been renamed usePrivateKeySync, setTrustedCertificatesSync, useCertificateChainSync, and setClientAuthoritiesSync to reflect the fact that they do blocking IO. Async-friendly versions have been added in usePrivateKeyBytes, setTrustedCertificatesBytes, useCertificateChainBytes, and setClientAuthoritiesBytes.
Static Properties
- defaultContext → SecurityContext
-
Secure networking classes with an optional
context
parameter use thedefaultContext
object if the parameter is omitted. This object can also be accessed, and modified, directly. Each isolate has a differentdefaultContext
object. ThedefaultContext
object uses a list of well-known trusted certificate authorities as its trusted roots. This list is taken from Mozilla, who maintains it as part of Firefox.read-only
Constructors
- SecurityContext()
-
factory
Properties
- hashCode → int
-
Get a hash code for this object.…
read-only, inherited - runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Operators
-
operator ==(
other) → bool -
The equality operator.…
inherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.…
inherited -
setAlpnProtocols(
List<String> protocols, bool isServer) → void -
Sets the list of application-level protocols supported by a client connection or server connection. The ALPN (application level protocol negotiation) extension to TLS allows a client to send a list of protocols in the TLS client hello message, and the server to pick one and send the selected one back in its server hello message.…
-
setClientAuthorities(
String file, {String password}) → void -
setClientAuthorities is deprecated. Use setClientAuthoritiesSync or setClientAuthoritiesBytes.
-
setClientAuthoritiesBytes(
List<int> authCertBytes, {String password}) → void -
Sets the list of authority names that a
SecureServer
will advertise as accepted, when requesting a client certificate from a connecting client.… -
setClientAuthoritiesSync(
String file, {String password}) → void -
Sets the list of authority names that a
SecureServer
will advertise as accepted when requesting a client certificate from a connecting client.… -
setTrustedCertificates(
String file, {String password}) → void -
setTrustedCertificates is deprecated. Use setTrustedCertificatesSync or setTrustedCertificatesBytes.
-
setTrustedCertificatesBytes(
List<int> certBytes, {String password}) → void -
Sets the set of trusted X509 certificates used by SecureSocket client connections, when connecting to a secure server.…
-
setTrustedCertificatesSync(
String file, {String password}) → void -
Sets the set of trusted X509 certificates used by SecureSocket client connections, when connecting to a secure server.…
-
toString(
) → String -
Returns a string representation of this object.
inherited -
useCertificateChain(
{String file, String directory, String password}) → void -
useCertificateChain is deprecated. Use useCertificateChainSync or useCertificateChainBytes.
-
useCertificateChainBytes(
List<int> chainBytes, {String password}) → void -
Sets the chain of X509 certificates served by
SecureServer
when making secure connections, including the server certificate.… -
useCertificateChainSync(
String file, {String password}) → void -
Sets the chain of X509 certificates served by
SecureServer
when making secure connections, including the server certificate.… -
usePrivateKey(
String keyFile, {String password}) → void -
usePrivateKey is deprecated. Use usePrivateKeySync or usePrivateKeyBytes.
-
usePrivateKeyBytes(
List<int> keyBytes, {String password}) → void -
Sets the private key for a server certificate or client certificate.…
-
usePrivateKeySync(
String keyFile, {String password}) → void -
Sets the private key for a server certificate or client certificate.…