TLSOptions
Inherits: RefCounted < Object
Description
Section titled “Description”TLS configuration for clients and servers.
TLSOptions abstracts the configuration options for the StreamPeerTLS and PacketPeerDTLS classes.
Objects of this class cannot be instantiated directly, and one of the static methods client(), client_unsafe(), or server() should be used instead.
Methods
Section titled “Methods”| Returns | Method |
|---|---|
| TLSOptions | client(trusted_chain: X509Certificate = null, common_name_override: String = "") static |
| TLSOptions | client_unsafe(trusted_chain: X509Certificate = null) static |
| String | get_common_name_override() const |
| X509Certificate | get_own_certificate() const |
| CryptoKey | get_private_key() const |
| X509Certificate | get_trusted_ca_chain() const |
| bool | is_server() const |
| bool | is_unsafe_client() const |
| TLSOptions | server(key: CryptoKey, certificate: X509Certificate) static |
Method descriptions
Section titled “Method descriptions”client
TLSOptions client(trusted_chain: X509Certificate = null, common_name_override: String = "") static
Creates a TLS client configuration which validates certificates and their common names (fully qualified domain names).
You can specify a custom trusted_chain of certification authorities (the default CA list will be used if null), and optionally provide a common_name_override if you expect the certificate to have a common name other than the server FQDN.
Note: On the Web platform, TLS verification is always enforced against the CA list of the web browser. This is considered a security feature.
client_unsafe
TLSOptions client_unsafe(trusted_chain: X509Certificate = null) static
Creates an unsafe TLS client configuration where certificate validation is optional. You can optionally provide a valid trusted_chain, but the common name of the certificates will never be checked. Using this configuration for purposes other than testing is not recommended.
Note: On the Web platform, TLS verification is always enforced against the CA list of the web browser. This is considered a security feature.
get_common_name_override
String get_common_name_override() const
Returns the common name (domain name) override specified when creating with client().
get_own_certificate
X509Certificate get_own_certificate() const
Returns the X509Certificate specified when creating with server().
get_private_key
CryptoKey get_private_key() const
Returns the CryptoKey specified when creating with server().
get_trusted_ca_chain
X509Certificate get_trusted_ca_chain() const
Returns the CA X509Certificate chain specified when creating with client() or client_unsafe().
is_server
bool is_server() const
Returns true if created with server(), false otherwise.
is_unsafe_client
bool is_unsafe_client() const
Returns true if created with client_unsafe(), false otherwise.
server
TLSOptions server(key: CryptoKey, certificate: X509Certificate) static
Creates a TLS server configuration using the provided key and certificate.
Note: The certificate should include the full certificate chain up to the signing CA (certificates file can be concatenated using a general purpose text editor).
