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

Specifying Schannel Ciphers and Cipher Strengths

· 52CE 我爱测

Specifying Schannel Ciphers and Cipher Strengths

For client/server information exchanges, the default behavior of Schannel is to negotiate the best cipher available based on those enabled in the registry. Applications may limit the ciphers and cipher strengths allowed for a connection by using members of the SCHANNEL_CRED structure as follows:

  1. Set the palgSupportedAlgs member to an array of ALG_ID containing the allowable ciphers. For more information, see Cipher IDs.
  2. Set the dwMinimumCipherStrength and/or dwMaximumCipherStrength members to the allowable minimum and maximum strengths. For more information, see Cipher Strength Values.
  3. Pass the SCHANNEL_CRED structure (by means of the pAuthData parameter) in a call to the AcquireCredentialsHandle function. This function returns a credentials handle.
  4. Specify the credentials handle in a call to the client-side InitializeSecurityContext (General) function or the server-side AcceptSecurityContext (General) function.

Cipher IDs

The default behavior of Schannel is to request the best cipher available based on Schannel entries in the system registry. Do not change the system registry; the settings it contains for Schannel are used globally and will affect other applications. For the list of valid constants, see ALG_ID.

Cipher Strength Values

This Schannel feature is typically used to limit a connection to either domestic or export strength ciphers. Domestic strengths include 56, and 128 bits, while export strength is limited to 56 bits. If you set the minimum and maximum values to zero Schannel will use all available cipher strengths.

Using TLS or SSL 3.0, set the dwMinimumCipherStrength member to -1 (negative one) to enable the "Null Cipher" cipher suites, which provide signatures but no encryption. If dwMaximumCipherStrength is also set to -1 then only the "Null Cipher" suites will be enabled. This setting is intended for development only and should not be used in production systems.

Querying Cipher Information

To retrieve the cipher strength settings for a credential, call the QueryCredentialsAttributes function and specify SECPKG_ATTR_CIPHER_STRENGTHS as the ulAttribute parameter.

To retrieve the list of supported algorithms for a credential, call the QueryCredentialsAttributes with SECPKG_ATTR_SUPPORTED_ALGS as the ulAttribute parameter.

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)

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

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