TripleDES.IsWeakKey(Byte[]) TripleDES.IsWeakKey(Byte[]) TripleDES.IsWeakKey(Byte[]) TripleDES.IsWeakKey(Byte[]) Method

定义

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

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

参数

rgbKey
Byte[]

要进行漏洞测试的机密密钥。The secret key to test for weakness.

返回

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

异常

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

注解

弱密钥是生成易于破解的密码的密钥。Weak keys are keys that result in ciphers that are easy to break. 如果使用弱密钥对文本进行加密,则使用相同的弱密钥再次加密生成的密码将返回原始文本。If text is encrypted with a weak key, encrypting the resulting cipher again with the same weak key returns the original text. 在128位模式下,如果第一个64位与最后一个64位相同,则密钥为弱密钥。In 128-bit mode, if the first 64 bits are the same as the last 64 bits, the key is weak. 在192位模式下,如果第一个64位与第二个64位相同,或者第二个64位与最后一个 "64" 位相同,则密钥为弱密钥。In 192-bit mode, if the first 64 bits are the same as the second 64 bits or if the second 64 bits are the same as the last 64 bits, the key is weak.

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

适用于

另请参阅