Package-level declarations

Types

Link copied to clipboard
fun interface CertificatePinner

A certificate-pinning hook for KtorTlsConnector: a check of the server's chain on top of TlsTrust, never instead of it. It runs during the TLS handshake, after the chain was validated against the trust anchors and found to name the server, and before any CoAP message is sent; refusing ends the handshake.

Link copied to clipboard
class KtorTcpConnector(selector: SelectorManager? = null, loggerFactory: LoggerFactory = LoggerFactory.Global) : Connector

Opens TCP connections for coap+tcp (RFC 8323 §8.1) on ktor-network, on every target ktor-network supports. The connection is a plain byte stream; the CoAP endpoint does the framing, the CSM exchange and everything else in common code.

Link copied to clipboard

Accepts TCP connections for coap+tcp (RFC 8323 §8.1) on ktor-network. Each accepted peer is an Endpoint.Tcp with its address in IpLiteral form and its own port.

Link copied to clipboard
class KtorTlsConnector(val config: TlsClientConfig = TlsClientConfig.Default, selector: SelectorManager? = null, loggerFactory: LoggerFactory = LoggerFactory.Global) : Connector

Opens TLS connections for coaps+tcp (RFC 8323 §8.2, §9.1) on ktor-network-tls, on the JVM and Android. The server is authenticated by certificate (the Certificate mode of RFC 8323 §9.1): its chain must be valid under TlsClientConfig.trust, the platform trust store by default, and name the host of the URI (RFC 9525 §6), and then pass TlsClientConfig.pinner if one is set; otherwise the handshake fails and nothing is sent. The connection reports that chain as its Connection.peerIdentity, a PeerIdentity.Certificate.

Link copied to clipboard

A UDP DatagramTransport on ktor-network, for coap on the JVM (and Android) and Apple platforms.

Link copied to clipboard
class TlsClientConfig(val trust: TlsTrust = TlsTrust.Platform, val pinner: CertificatePinner? = null, val allowsAnyPortWithoutAlpn: Boolean = false)

How a KtorTlsConnector runs TLS for coaps+tcp (RFC 8323 §8.2, §9.1).

Link copied to clipboard
sealed interface TlsTrust

Which certificate authorities a KtorTlsConnector trusts to vouch for a server (RFC 8323 §9.1, Certificate mode). Either way the chain is validated by the platform's PKIX trust manager (signatures, validity, basic constraints, key usage), and the server must then be named by its certificate.