带有Windows的C ++客户端DIGEST-MD5 sasl auth的示例

时间:2017-03-31 17:10:52

标签: c++ windows authentication sasl sspi

有人可以通过一个关于如何使用Windows API对Windows sasl服务器进行身份验证的简单示例来帮助我:使用AcquireCredentialsHandle,InitializeSecurityContext ...

目前我得到的最好结果是这个配置:

set(&credentials, "username", "password", "domain");
ss= AcquireCredentialsHandle(NULL, "WDigest", SECPKG_CRED_OUTBOUND, NULL      
                            , &credentials, NULL, NULL, &hCred, &tsExpiry);
OutBuffers[0].pvBuffer = NULL;
OutBuffers[0].BufferType = SECBUFFER_TOKEN;
OutBuffers[0].cbBuffer = 0;
OutBuffer.cBuffers = 1;
OutBuffer.pBuffers = OutBuffers;
OutBuffer.ulVersion = SECBUFFER_VERSION;
scRet = InitializeSecurityContext(&hCred, NULL, "server", ISC_REQ_ALLOCATE_MEMORY
                                 , 0, SECURITY_NATIVE_DREP, NULL, 0, hContext
                                 , &OutBuffer, &dwSSPIOutFlags, &tsExpiry);

ss结果没问题,scRet是SEC_I_CONTINUE_NEEDED,但是outBuffers [0]为空,所以我没有任何东西要发送到服务器继续验证过程。

0 个答案:

没有答案