tls/ctx
src/tls/ctx.tur
defn
tls-ctx-new
(tls-ctx-new :)
allocate and initialize a new server-side TLS context.
Returns
Handle as :int on success; 0 on allocation or RNG seed failure.
Example
(let [ctx (tls-ctx-new)]
(tls-ctx-load-cert-pem ctx "cert.pem")
(tls-ctx-load-key-pem ctx "key.pem")
...
(tls-ctx-free ctx))
Since: T2
defn
tls-ctx-free
(tls-ctx-free [ctx : int] :)
release a TLS context and every mbedTLS sub-object it owns.
Parameters
| ctx | handle returned by tls-ctx-new. 0 is a safe no-op. |
Since: T2
defn
tls-ctx-load-cert-pem
(tls-ctx-load-cert-pem [ctx : int path : cstr] :)
load a PEM certificate chain into the context.
Parameters
| ctx | handle from tls-ctx-new. | |
| path | filesystem path to a PEM file containing the server cert | |
| (optionally followed by any intermediate certs). |
Returns
0 on success; non-zero mbedTLS error code on failure (file missing, not a PEM, malformed, etc.).
Since: T2
defn
tls-ctx-load-key-pem
(tls-ctx-load-key-pem [ctx : int path : cstr] :)
load a PEM private key and finalize the conf binding.
Parameters
| ctx | handle from tls-ctx-new. | |
| path | filesystem path to a PEM-encoded private key (unencrypted). |
Returns
0 on success; non-zero mbedTLS error code on key-parse or conf-bind failure.
Since: T2