我在c#中使用AES加密和解密算法,.I am使用c#类进行加密和解密。
下面是我在代码中的设置
AesCryptoServiceProvider result = new AesCryptoServiceProvider();
result.BlockSize = 128;
result.KeySize = 256;
result.Mode = CipherMode.CBC;
result.Padding = PaddingMode.PKCS7;我不太明白我在这里使用的代码是AES 128还是AES 256的实现。
简单的问题是如何识别您正在使用的AES 256 / AES 128 ?
我试过这个链接:http://social.msdn.microsoft.com/Forums/vstudio/en-US/ac5f4d30-343e-484e-b795-b214820a9327/aes-net-encryption-is-it-always-256-bit-aes
但我没有得到答案。
发布于 2013-08-21 07:25:21
是AES 256。这个号码是关键的尺寸。
来自维基百科
严格地说,AES标准是Rijndael的变体,其中块大小被限制为128位。
所以块大小总是128。
我不能向您指出任何官方文档,因为(据我所知) AES-<Number>一直是一个非正式的速记。我可以指出布鲁斯施耐尔( Bruce )的博客邮报,它引用了一篇研究论文:
AES是最著名和应用最广泛的分组密码。它的三个版本(AES-128、AES-192和AES- 256 )在密钥大小(128位、192位和256位)和轮数(分别为10、12和14次)上有所不同。如果是..。
虽然你的客户可能不喜欢剩下的博客文章,因为它是施耐尔推荐的AES-128而不是AES-256。
发布于 2013-08-31 21:22:26
AES的官方规范是FIPS-197.它包含以下有关键大小和块大小的文本。
1. Introduction
This standard specifies the Rijndael algorithm ([3] and [4]), a symmetric block cipher that can
process data blocks of 128 bits, using cipher keys with lengths of 128, 192, and 256 bits.
Rijndael was designed to handle additional block sizes and key lengths, however they are not
adopted in this standard.
Throughout the remainder of this standard, the algorithm specified herein will be referred to as
“the AES algorithm.” The algorithm may be used with the three different key lengths indicated
above, and therefore these different “flavors” may be referred to as “AES-128”, “AES-192”, and
“AES-256”.由于NIST在比赛后选择Rijndael为AES,您无法获得更权威的参考。
请注意,虽然您的代码还包含CBC和PKCS#7填充,但它们并不是AES规范的一部分。CBC是NIST批准的一种分组密码方式(参见NIST SP 800-38A)。该规范还提到,NIST没有考虑填充方案,可能是因为它们不应该用作提供任何安全性的算法(对于分组密码模式,也就是)。
https://stackoverflow.com/questions/18351184
复制相似问题