Tls module

tls_config_init

procedureextensionexperimentalSource

Parses the certificates and keys and builds the mbedTLS configurations. Call it once before the first connection; the config must stay where it is and outlive every stream made from it. Returns .CONFIG with a reason for a certificate or key that does not parse, a version range that is empty, or a server certificate without its key. A config with no certificate is a client; one with a certificate and key can also accept.

Example↗
config: Tls_Config; // a client, trusting the system's roots
error := tls_config_init(*config);
assert(error.kind == .NONE, "%", error_text(error));
tls_config_free(*config);

This one is only checked to compile, not run.

tls_config_init :: (config: *Tls_Config) -> Tls_Error

Parses the certificates and keys and builds the mbedTLS configurations. Call it once before the first connection; the config must stay where it is and outlive every stream made from it. Returns .CONFIG with a reason for a certificate or key that does not parse, a version range that is empty, or a server certificate without its key. A config with no certificate is a client; one with a certificate and key can also accept.

Parameters

config: *Tls_Config
the filled-in config. The native state is attached to it.

Returns

Example↗
config: Tls_Config; // a client, trusting the system's roots
error := tls_config_init(*config);
assert(error.kind == .NONE, "%", error_text(error));
tls_config_free(*config);

This one is only checked to compile, not run.

See also