大网数据广告活动
账户与安全

Client Context Initialization

· 52CE 我爱测

To establish a secure connection, the client acquires an outbound *credentials* handle before sending an authentication request to the server. The server creates a security context for the client from the authentication request. There are two client-side SSPI functions involved in authentication setup:

To establish a secure connection, the client acquires an outbound credentials handle before sending an authentication request to the server. The server creates a security context for the client from the authentication request. There are two client-side SSPI functions involved in authentication setup:

Code for this process can be seen in the GenClientContext function in Using SSPI with a Windows Sockets Client.

If a client program needs to use credentials in addition to its own logon credentials, such as a different user name, domain name, and password, it provides them in the AcquireCredentialsHandle call with a SEC_WINNT_AUTH_IDENTITY structure specifying the additional credentials. For more information on credentials functions, see Credential Management.

Note:
The Flags member of the SEC_WINNT_AUTH_IDENTITY structure can be set to SEC_WINNT_AUTH_IDENTITY_ANSI when strings in the structure are ASCI or OEM. ANSI strings can be used with the Flags member of the SEC_WINNT_AUTH_IDENTITY structure set to SEC_WINNT_AUTH_IDENTITY_UNICODE if they are first converted to Unicode by using the MultiByteToWideChar function.

To initiate the first leg of the authentication, the client calls InitializeSecurityContext (General) to obtain an initial security token to be sent in a connection request message to the server.

The client uses the security token information received in the output buffer descriptor to generate a message to send to the server. The construction of the message, in terms of placement of various buffers and so forth, is part of the application protocol and must be understood by both parties.

The client checks the return status from InitializeSecurityContext (General) to see if authentication will complete in a single call. A return status of SEC_I_CONTINUE_NEEDED indicates that the security protocol requires multiple authentication messages. For more information on context functions, see Context Management.

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。