Module tls

Procs

proc wrapTls*(pipe: BytePipe): TlsPipe
Wrap raw pipe with a secure TLS connection. After this you still need to call handshakeAsClient or handshakeAsServer.   Source Edit
proc handshakeAsClient*(self: TlsPipe; hostname: string = nil; verify = true) {.
async
.}

Initialize TLS connection as client. If hostname is set, request server to send certificate for it (using SNI).

INSECURE: doesn't verify certificate name yet.

  Source Edit
proc connectTls*(hostname: string; port: int): Future[TlsPipe] {.
async
.}
Connect to TCP socket using TLS protocol.   Source Edit
proc handshakeAsServer*(self: TlsPipe; certificateFile: string; keyFile: string) {.
async
.}
Initialize TLS connection as server.   Source Edit
proc close*(t: TlsPipe; err: ref Exception)
  Source Edit