DES.IsSemiWeakKey(Byte[]) 方法

定义

确定指定的密钥是否为半弱密钥。Determines whether the specified key is semi-weak.

public:
 static bool IsSemiWeakKey(cli::array <System::Byte> ^ rgbKey);
public static bool IsSemiWeakKey (byte[] rgbKey);
static member IsSemiWeakKey : byte[] -> bool
Public Shared Function IsSemiWeakKey (rgbKey As Byte()) As Boolean

参数

rgbKey
Byte[]

要进行半弱漏洞测试的密钥。The secret key to test for semi-weakness.

返回

Boolean

如果密钥为半弱密钥,则为 true;否则为 falsetrue if the key is semi-weak; otherwise, false.

例外

rgbKey 参数的大小无效。The size of the rgbKey parameter is not valid.

注解

半弱密钥是生成易于破解的密码对的键对。Semi-weak keys are pairs of keys that result in ciphers that are easy to break. 如果使用半弱密钥对文本进行加密,则使用该半弱密钥的伙伴对生成的密码进行加密将返回原始文本。If text is encrypted with a semi-weak key, encrypting the resulting cipher with the partner of that semi-weak key returns the original text. 对于数据加密标准 () 算法有六个已知的半弱密钥对, DES 此方法会检查那些半弱密钥。There are six known semi-weak key pairs for the Data Encryption Standard (DES) algorithm; this method checks for those semi-weak keys.

尝试设置半弱密钥会导致 CryptographicExceptionAttempting to set a semi-weak key results in a CryptographicException. GenerateKey调用以创建随机密钥时,绝不会返回半弱密钥。When GenerateKey is called to create a random key, a semi-weak key will never be returned.

适用于