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

Obtaining Schannel Credentials

· 52CE 我爱测

Learn how to obtain Schannel credentials required for authentication. Both client and server must get valid credentials to establish a security context for secure message exchange.

Credentials are required by the Schannel authentication process; both client and server must obtain valid credentials to establish a security context for message exchange. For an example that demonstrates this procedure, see Getting credentials.

Your application obtains credentials by calling the AcquireCredentialsHandle function, which returns a handle to the requested credentials. Because credentials handles are used to store configuration information, the same handle cannot be used for both client-side and server-side operations. This means that applications that support both client and server connections must obtain a minimum of two credentials handles.

An SCHANNEL_CRED structure specifies the following:

  • A security protocol
  • The allowable ciphers
  • Minimum and maximum cipher strengths
  • An X.509 certificate used for authentication — Required for server, optional for client unless server requests client authentication.

Pass the SCHANNEL_CRED structure (via the pAuthData parameter) to the AcquireCredentialsHandle function. This function returns the credentials handle required to establish a security context.

Security support provider interface (SSPI) callers can use TLS 1.3 by passing the new crypto-agile SCH_CREDENTIALS structure when calling AcquireCredentialsHandle, which enables TLS 1.3 by default. SSPI callers using TLS 1.3 need to make sure their code correctly handles SEC_I_RENEGOTIATE. See the blog post Taking Transport Layer Security (TLS) to the next level with TLS 1.3 for more information.

For detailed information on setting the ciphers used with Schannel, see Specifying Schannel Ciphers and Cipher Strengths.

For information about certificates, see Certificate and Certificate Store Functions.

For an example that demonstrates opening a certificate store and locating a certificate to use for Schannel authentication, see Getting a Certificate.

Related content

Getting credentials

Taking Transport Layer Security (TLS) to the next level with TLS 1.3

AcquireCredentialsHandle

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 09/23/2025
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

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

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