From 76b6528058e1cb9fefb0547b672acb83e7b41ff4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Remko=20Tron=C3=A7on?= <git@el-tramo.be>
Date: Wed, 25 Apr 2012 19:32:37 +0200
Subject: Support channel binding with Schannel.

Resolves: #1012

diff --git a/Swiften/TLS/Schannel/SchannelContext.cpp b/Swiften/TLS/Schannel/SchannelContext.cpp
index 20cb7d3..641568d 100644
--- a/Swiften/TLS/Schannel/SchannelContext.cpp
+++ b/Swiften/TLS/Schannel/SchannelContext.cpp
@@ -640,10 +640,12 @@ CertificateVerificationError::ref SchannelContext::getPeerCertificateVerificatio
 //------------------------------------------------------------------------
 
 ByteArray SchannelContext::getFinishMessage() const {
-	// TODO: Implement
-
-	ByteArray emptyArray;
-	return emptyArray;
+	SecPkgContext_Bindings bindings;
+	int ret = QueryContextAttributes(m_ctxtHandle, SECPKG_ATTR_UNIQUE_BINDINGS, &bindings);
+	if (ret == SEC_E_OK) {
+		return createByteArray(((unsigned char*) bindings.Bindings) + bindings.Bindings->dwApplicationDataOffset + 11 /* tls-unique:*/, bindings.Bindings->cbApplicationDataLength - 11);
+	}
+	return ByteArray();
 }
 
 //------------------------------------------------------------------------
-- 
cgit v0.10.2-6-g49f6