Add pinned TLS fingerprint support.

This patch adds support for pinning TLS fingerprints. Setting a pinned
fingerprint will override all other TLS verification and will thus be
the only variable that will be looked at when connecting to a TLS
enabled IRC server.
This commit is contained in:
Alexander Færøy 2015-09-19 01:26:09 +02:00
commit 78f007d493
No known key found for this signature in database
GPG key ID: E15081D5D3C3DB53
31 changed files with 1114 additions and 357 deletions

View file

@ -930,3 +930,23 @@ char **strsplit_len(const char *str, int len, gboolean onspace)
return ret;
}
char *binary_to_hex(unsigned char *buffer, size_t size)
{
static const char hex[] = "0123456789ABCDEF";
char *result = NULL;
int i;
if (buffer == NULL || size == 0)
return NULL;
result = g_malloc(2 * size + size);
for (i = 0; i < size; i++) {
result[i * 3 + 0] = hex[(buffer[i] >> 4) & 0xf];
result[i * 3 + 1] = hex[(buffer[i] >> 0) & 0xf];
result[i * 3 + 2] = i == size - 1 ? '\0' : ':';
}
return result;
}