The object containing the certificates to trust when makinga secure client connection, and the certificate chain andprivate key to serve from a secure server.
TheSecureSocket andSecureServerSocket classes take a SecurityContextas an argument to their connect and bind methods.
Certificates and keys can be added to a SecurityContext from either PEMor PKCS12 containers.
iOS note: Some methods to add, remove, and inspect certificates are not yetimplemented. However, the platform's built-in trusted certificates canbe used, by way ofSecurityContext.defaultContext.
Constructors
- SecurityContext({boolwithTrustedRoots =false})
- Creates a newSecurityContext.factory
Properties
- allowLegacyUnsafeRenegotiation↔bool
- If
true, theSecurityContext will allow TLS renegotiation.Renegotiation is only supported as a client and the HelloRequest must bereceived at a quiet point in the application protocol. This is sufficientto support the legacy use case of requesting a new client certificatebetween an HTTP request and response in (unpipelined) HTTP/1.1.NOTE: Renegotiation is an extremely problematic protocol feature andshould only be used to communicate with legacy servers in environmentswhere it is known to be safe.getter/setter pair - hashCode→int
- The hash code for this object.no setterinherited
- minimumTlsProtocolVersion↔TlsProtocolVersion
- The minimum TLS version to use when establishing a secure connection.getter/setter pair
- runtimeType→Type
- A representation of the runtime type of the object.no setterinherited
Methods
- noSuchMethod(
Invocationinvocation)→ dynamic - Invoked when a nonexistent method or property is accessed.inherited
- setAlpnProtocols(
List< String> protocols,boolisServer)→ void - Sets the list of application-level protocols supported by a clientconnection or server connection. The ALPN (application level protocolnegotiation) extension to TLS allows a client to send a list ofprotocols in the TLS client hello message, and the server to pickone and send the selected one back in its server hello message.
- setClientAuthorities(
Stringfile, {String?password})→ void - Sets the list of authority names that aSecureServerSocket will advertiseas accepted when requesting a client certificate from a connectingclient.
- setClientAuthoritiesBytes(
List< int> authCertBytes, {String?password})→ void - Sets the list of authority names that aSecureServerSocket will advertiseas accepted, when requesting a client certificate from a connectingclient.
- setTrustedCertificates(
Stringfile, {String?password})→ void - Add a certificate to the set of trusted X509 certificatesused bySecureSocket client connections.
- setTrustedCertificatesBytes(
List< int> certBytes, {String?password})→ void - Add a certificate to the set of trusted X509 certificatesused bySecureSocket client connections.
- toString(
)→String - A string representation of this object.inherited
- useCertificateChain(
Stringfile, {String?password})→ void - Sets the chain of X509 certificates served bySecureServerSocketwhen making secure connections, including the server certificate.
- useCertificateChainBytes(
List< int> chainBytes, {String?password})→ void - Sets the chain of X509 certificates served bySecureServerSocketwhen making secure connections, including the server certificate.
- usePrivateKey(
Stringfile, {String?password})→ void - Sets the private key for a server certificate or client certificate.
- usePrivateKeyBytes(
List< int> keyBytes, {String?password})→ void - Sets the private key for a server certificate or client certificate.
Operators
- operator ==(
Objectother)→bool - The equality operator.inherited
Static Properties
- alpnSupported→bool
- Whether the platform supports ALPN. This always returns true and will beremoved in a future release.no setter
- defaultContext→SecurityContext
- The default security context used by most operation requiring one.no setter