AtlatestRenderedmarkdown
Readme

sigil-tls

TLS/SSL client connections for Sigil.

Secure TCP connections using mbedTLS. Supports TLS 1.2 client connections with system CA certificate verification, non-blocking I/O, and STARTTLS upgrades of existing sockets.

Modules

ModulePurpose
(sigil tls)TLS 1.2 client connections

API summary

ProcedurePurpose
tls-connectOpen a TLS connection to a host/port
tls-upgradeUpgrade an existing TCP socket to TLS (STARTTLS)
tls-readRead a string from a TLS connection
tls-read-bytevectorRead raw bytes from a TLS connection
tls-writeWrite a string or bytevector to a TLS connection
tls-closeClose a TLS connection
tls-closed?Whether a connection is closed
tls-connection?Whether a value is a TLS connection
tls-set-non-blocking!Toggle non-blocking mode on the underlying socket

System prerequisites

None beyond a working C toolchain. mbedTLS is consumed transitively via sigil-crypto, which vendors mbedTLS and exposes its headers to downstream consumers automatically.

Dependencies

  • sigil-stdlib
  • sigil-crypto (vendors mbedTLS)

Build

sigil deps install
sigil build
sigil test --report

Usage

(import (sigil tls))

(let ((conn (tls-connect "example.com" 443)))
  (tls-write conn "GET / HTTP/1.1\r\nHost: example.com\r\n\r\n")
  (display (tls-read conn))
  (tls-close conn))

Set SIGIL_TLS_INSECURE=1 to skip certificate verification (testing only).

License

BSD-3-Clause. See sigil-crypto for the vendored mbedTLS license terms.