Next: , Previous: , Up: Advanced topics   [Contents][Index]

6.12.8 Channel bindings

In user authentication protocols (e.g., EAP or SASL mechanisms) it is useful to have a unique string that identifies the secure channel that is used, to bind together the user authentication with the secure channel. This can protect against man-in-the-middle attacks in some situations. That unique string is called a “channel binding”. For background and discussion see [RFC5056].

In GnuTLS you can extract a channel binding using the gnutls_session_channel_binding function. Currently only the following types are supported:

The following example describes how to print the channel binding data. Note that it must be run after a successful TLS handshake.

  gnutls_datum_t cb;
  int rc;

  rc = gnutls_session_channel_binding (session,
  if (rc)
    fprintf (stderr, "Channel binding error: %s\n",
             gnutls_strerror (rc));
      size_t i;
      printf ("- Channel binding 'tls-unique': ");
      for (i = 0; i < cb.size; i++)
        printf ("%02x",[i]);
      printf ("\n");