AtlatestRepositorysigil-tls
1
# sigil-tls3
TLS/SSL client connections for [Sigil](https://codeberg.org/sigil/sigil).5
Secure TCP connections using mbedTLS. Supports TLS 1.2 client connections6
with system CA certificate verification, non-blocking I/O, and STARTTLS7
upgrades of existing sockets.9
## Modules11
| Module | Purpose |12
|----------------|-----------------------------------------|13
| `(sigil tls)` | TLS 1.2 client connections |15
## API summary17
| Procedure | Purpose |18
|---------------------------|--------------------------------------------------------|19
| `tls-connect` | Open a TLS connection to a host/port |20
| `tls-upgrade` | Upgrade an existing TCP socket to TLS (STARTTLS) |21
| `tls-read` | Read a string from a TLS connection |22
| `tls-read-bytevector` | Read raw bytes from a TLS connection |23
| `tls-write` | Write a string or bytevector to a TLS connection |24
| `tls-close` | Close a TLS connection |25
| `tls-closed?` | Whether a connection is closed |26
| `tls-connection?` | Whether a value is a TLS connection |27
| `tls-set-non-blocking!` | Toggle non-blocking mode on the underlying socket |29
## System prerequisites31
None beyond a working C toolchain. mbedTLS is consumed transitively via32
[sigil-crypto](https://codeberg.org/sigil/sigil-crypto), which vendors33
mbedTLS and exposes its headers to downstream consumers automatically.35
## Dependencies37
- sigil-stdlib38
- sigil-crypto (vendors mbedTLS)40
## Build42
```sh43
sigil deps install44
sigil build45
sigil test --report46
```48
## Usage50
```scheme51
(import (sigil tls))53
(let ((conn (tls-connect "example.com" 443)))54
(tls-write conn "GET / HTTP/1.1\r\nHost: example.com\r\n\r\n")55
(display (tls-read conn))56
(tls-close conn))57
```59
Set `SIGIL_TLS_INSECURE=1` to skip certificate verification (testing only).61
## License63
BSD-3-Clause. See sigil-crypto for the vendored mbedTLS license terms.