manpagez: man pages & more
info gnutls
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.5.3 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. The unique strings is a “channel bindings”. For background and more discussion see [RFC5056]

You can extract a channel bindings using the gnutls_session_channel_binding function. Currently only the GNUTLS_CB_TLS_UNIQUE type is supported, which corresponds to the tls-unique channel bindings for TLS defined in [RFC5929]

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,
                                       GNUTLS_CB_TLS_UNIQUE,
                                       &cb);
  if (rc)
    fprintf (stderr, "Channel binding error: %s\n",
             gnutls_strerror (rc));
  else
    {
      size_t i;
      printf ("- Channel binding 'tls-unique': ");
      for (i = 0; i < cb.size; i++)
        printf ("%02x", cb.data[i]);
      printf ("\n");
    }
}

© manpagez.com 2000-2025
Individual documents may contain additional copyright information.