Last active
June 25, 2022 10:25
-
-
Save sayurin/66feda689003402c880d73a80925e60a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define SECURITY_WIN32 | |
#include <iostream> | |
#include <tuple> | |
#include <Windows.h> | |
#include <security.h> | |
#include <schannel.h> | |
#pragma comment(lib, "Secur32.lib") | |
static std::tuple<int, const char*> protocols[] = { | |
{ SP_PROT_PCT1_CLIENT, "PCT 1.0" }, | |
{ SP_PROT_SSL2_CLIENT, "SSL 2.0" }, | |
{ SP_PROT_SSL3_CLIENT, "SSL 3.0" }, | |
{ SP_PROT_TLS1_0_CLIENT, "TLS 1.0" }, | |
{ SP_PROT_TLS1_1_CLIENT, "TLS 1.1" }, | |
{ SP_PROT_TLS1_2_CLIENT, "TLS 1.2" }, | |
{ SP_PROT_TLS1_3_CLIENT, "TLS 1.3" }, | |
{ SP_PROT_DTLS1_0_CLIENT, "DTLS1.0" }, | |
{ SP_PROT_DTLS1_2_CLIENT, "DTLS1.2" }, | |
{ SP_PROT_UNI_CLIENT, "UNI " }, | |
}; | |
void test(int i, bool force) { | |
SCHANNEL_CRED sc{ SCHANNEL_CRED_VERSION, 0, nullptr, 0, 0, nullptr, 0, nullptr, 0 }; | |
for (size_t j = 0; j < std::size(protocols); j++) | |
if (i & 1 << j) | |
sc.grbitEnabledProtocols |= std::get<0>(protocols[j]); | |
CredHandle credential; | |
if (auto ss = AcquireCredentialsHandleW(nullptr, const_cast<wchar_t*>(UNISP_NAME_W), SECPKG_CRED_OUTBOUND, nullptr, &sc, nullptr, nullptr, &credential, nullptr); ss != SEC_E_OK) | |
return; | |
SecPkgCred_SupportedProtocols sp; | |
if (auto ss = QueryCredentialsAttributesW(&credential, SECPKG_ATTR_SUPPORTED_PROTOCOLS, &sp); ss != SEC_E_OK) | |
throw ss; | |
FreeCredentialsHandle(&credential); | |
if (!force) | |
if (sc.grbitEnabledProtocols != sp.grbitProtocol) | |
return; | |
for (auto [protocol, name] : protocols) | |
std::cout << " " << (sp.grbitProtocol & protocol ? name : " "); | |
std::cout << std::endl; | |
} | |
int main() { | |
std::cout << "default combinations:" << std::endl; | |
test(0, true); | |
std::cout << "available combinations:" << std::endl; | |
for (int i = 1; i < 1 << std::size(protocols); i++) | |
test(i, false); | |
return 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
default combinations: | |
TLS 1.0 TLS 1.1 TLS 1.2 DTLS1.0 DTLS1.2 | |
available combinations: | |
SSL 3.0 | |
TLS 1.0 | |
SSL 3.0 TLS 1.0 | |
TLS 1.1 | |
SSL 3.0 TLS 1.1 | |
TLS 1.0 TLS 1.1 | |
SSL 3.0 TLS 1.0 TLS 1.1 | |
TLS 1.2 | |
SSL 3.0 TLS 1.2 | |
TLS 1.0 TLS 1.2 | |
SSL 3.0 TLS 1.0 TLS 1.2 | |
TLS 1.1 TLS 1.2 | |
SSL 3.0 TLS 1.1 TLS 1.2 | |
TLS 1.0 TLS 1.1 TLS 1.2 | |
SSL 3.0 TLS 1.0 TLS 1.1 TLS 1.2 | |
DTLS1.0 | |
DTLS1.2 | |
DTLS1.0 DTLS1.2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
default combinations: | |
SSL 3.0 TLS 1.0 DTLS1.0 | |
available combinations: | |
SSL 2.0 | |
SSL 3.0 | |
TLS 1.0 | |
SSL 3.0 TLS 1.0 | |
TLS 1.1 | |
SSL 3.0 TLS 1.1 | |
TLS 1.0 TLS 1.1 | |
SSL 3.0 TLS 1.0 TLS 1.1 | |
TLS 1.2 | |
SSL 3.0 TLS 1.2 | |
TLS 1.0 TLS 1.2 | |
SSL 3.0 TLS 1.0 TLS 1.2 | |
TLS 1.1 TLS 1.2 | |
SSL 3.0 TLS 1.1 TLS 1.2 | |
TLS 1.0 TLS 1.1 TLS 1.2 | |
SSL 3.0 TLS 1.0 TLS 1.1 TLS 1.2 | |
DTLS1.0 | |
SSL 2.0 SSL 3.0 UNI | |
SSL 2.0 TLS 1.0 UNI | |
SSL 2.0 SSL 3.0 TLS 1.0 UNI | |
SSL 2.0 TLS 1.1 UNI | |
SSL 2.0 SSL 3.0 TLS 1.1 UNI | |
SSL 2.0 TLS 1.0 TLS 1.1 UNI | |
SSL 2.0 SSL 3.0 TLS 1.0 TLS 1.1 UNI |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
default combinations: | |
SSL 3.0 TLS 1.0 | |
available combinations: | |
SSL 2.0 | |
SSL 3.0 | |
TLS 1.0 | |
SSL 3.0 TLS 1.0 | |
TLS 1.1 | |
SSL 3.0 TLS 1.1 | |
TLS 1.0 TLS 1.1 | |
SSL 3.0 TLS 1.0 TLS 1.1 | |
TLS 1.2 | |
SSL 3.0 TLS 1.2 | |
TLS 1.0 TLS 1.2 | |
SSL 3.0 TLS 1.0 TLS 1.2 | |
TLS 1.1 TLS 1.2 | |
SSL 3.0 TLS 1.1 TLS 1.2 | |
TLS 1.0 TLS 1.1 TLS 1.2 | |
SSL 3.0 TLS 1.0 TLS 1.1 TLS 1.2 | |
SSL 2.0 SSL 3.0 UNI | |
SSL 2.0 TLS 1.0 UNI | |
SSL 2.0 SSL 3.0 TLS 1.0 UNI | |
SSL 2.0 TLS 1.1 UNI | |
SSL 2.0 SSL 3.0 TLS 1.1 UNI | |
SSL 2.0 TLS 1.0 TLS 1.1 UNI | |
SSL 2.0 SSL 3.0 TLS 1.0 TLS 1.1 UNI |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
default combinations: | |
SSL 3.0 TLS 1.0 | |
available combinations: | |
SSL 2.0 | |
SSL 3.0 | |
TLS 1.0 | |
SSL 3.0 TLS 1.0 | |
SSL 2.0 SSL 3.0 UNI | |
SSL 2.0 TLS 1.0 UNI | |
SSL 2.0 SSL 3.0 TLS 1.0 UNI |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
default combinations: | |
SSL 2.0 SSL 3.0 TLS 1.0 UNI | |
available combinations: | |
SSL 2.0 | |
SSL 3.0 | |
TLS 1.0 | |
SSL 3.0 TLS 1.0 | |
TLS 1.1 | |
SSL 3.0 TLS 1.1 | |
TLS 1.0 TLS 1.1 | |
SSL 3.0 TLS 1.0 TLS 1.1 | |
TLS 1.2 | |
SSL 3.0 TLS 1.2 | |
TLS 1.0 TLS 1.2 | |
SSL 3.0 TLS 1.0 TLS 1.2 | |
TLS 1.1 TLS 1.2 | |
SSL 3.0 TLS 1.1 TLS 1.2 | |
TLS 1.0 TLS 1.1 TLS 1.2 | |
SSL 3.0 TLS 1.0 TLS 1.1 TLS 1.2 | |
SSL 2.0 SSL 3.0 UNI | |
SSL 2.0 TLS 1.0 UNI | |
SSL 2.0 SSL 3.0 TLS 1.0 UNI | |
SSL 2.0 TLS 1.1 UNI | |
SSL 2.0 SSL 3.0 TLS 1.1 UNI | |
SSL 2.0 TLS 1.0 TLS 1.1 UNI | |
SSL 2.0 SSL 3.0 TLS 1.0 TLS 1.1 UNI |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
default combinations: | |
SSL 2.0 SSL 3.0 TLS 1.0 UNI | |
available combinations: | |
SSL 2.0 | |
SSL 3.0 | |
TLS 1.0 | |
SSL 3.0 TLS 1.0 | |
SSL 2.0 SSL 3.0 UNI | |
SSL 2.0 TLS 1.0 UNI | |
SSL 2.0 SSL 3.0 TLS 1.0 UNI |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment