我在 c# 中使用 AES 算法进行加密和解密。我使用 AesCryptoServiceProvider 类进行加密和解密。
这是我在代码中的设置
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?
但我没有得到答案。
最佳答案
是AES 256,数字就是 key 大小。
来自 Wikipedia :
Strictly speaking, the AES standard is a variant of Rijndael where the block size is restricted to 128 bits.
所以 block 大小总是 128。
我无法向您指出任何官方文档,因为(据我所知)AES-<Number>
一直是非官方的速记。我可以给你指点 Bruce Schneier Blog Post其中引用了一篇研究论文:
AES is the best known and most widely used block cipher. Its three versions (AES-128, AES-192, and AES-256) differ in their key sizes (128 bits, 192 bits and 256 bits) and in their number of rounds (10, 12, and 14, respectively). In the case of ...
尽管您的客户可能不喜欢该博文的其余部分,因为 Schneier 推荐 AES-128 而不是 AES-256。
关于c# - 识别 AES 算法。是 AES 128 还是 AES 256?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18351184/