pushtls, tlsClient, tlsServer, initThumbprints, freeThumbprints, okThumbprint, readcert, readcertchain \- attach TLS1 or SSL3 encryption to a communication channel
.SH SYNOPSIS
.B #include <u.h>
.br
.B #include <libc.h>
.PP
.nf
.B
int pushtls(int fd, char *hashalg, char *encalg,
.B
int isclient, char *secret, char *dir)
.PP
.nf
.B #include <mp.h>
.B #include <libsec.h>
.PP
.B
int tlsClient(int fd, TLSconn *conn)
.PP
.B
int tlsServer(int fd, TLSconn *conn)
.PP
.B
uchar *readcert(char *filename, int *pcertlen)
.PP
.B
PEMchain *readcertchain(char *filename)
.PP
.B
Thumbprint *initThumbprints(char *ok, char *crl)
.PP
.B
void freeThumbprints(Thumbprint *table)
.PP
.B
int okThumbprint(uchar *hash, Thumbprint *table)
.SH DESCRIPTION
Transport Layer Security (TLS) comprises a record layer protocol,
doing message digesting and encrypting in the kernel,
and a handshake protocol,
doing initial authentication and secret creation at
user level and then starting a data channel in the record protocol.
TLS is nearly the same as SSL 3.0, and the software should interoperate
with implementations of either standard.
.PP
To use just the record layer, as described in
.IR tls (3),
call
.I pushtls
to open the record layer device, connect to the communications channel
.IR fd ,
and start up encryption and message authentication as specified
in
.IR hashalg ,
.IR encalg ,
and
.IR secret .
These parameters must have been arranged at the two ends of the
conversation by other means.
For example,
.I hashalg
could be
.BR sha1 ,
.I encalg
could be
.BR rc4_128 ,
and
.I secret
could be the base-64 encoding of two (client-to-server and server-to-client)
20-byte digest keys and two corresponding 16-byte encryption keys.
.I Pushtls
returns a file descriptor for the TLS data channel. Anything written to this
descriptor will get encrypted and authenticated and then written to the