[Help-gnutls] Re: STARTTLS example using GnuTLS C api

Simon Josefsson simon at josefsson.org
Thu Jan 11 15:05:58 CET 2007

"Alexander Semyonov" <bohtvaroh at gmail.com> writes:

> Hi. I am implementing Jabber (XMPP) protocol and I need an example about
> acompleting the starttls procedure with gnutls api (as I understood - switch
> to secure tcp connection on existing unsecure one). I tried Google but
> couldnt find any example. Can someone supply me with it? Thanx.

GNU SASL uses GnuTLS to do STARTTLS for IMAP and SMTP, look at
src/gsasl.c, although it is a rather complex example.  GnuTLS doesn't
care if you use starttls, the API you use are the same, so you could
take a look at the examples in the manual:


Insert your read/write's to negotiate STARTTLS in the unprotected
protocol, right after the call to tcp_connect().


More information about the Gnutls-help mailing list