简体   繁体   English

C#中的AES256加密

[英]AES256 Encryption in C#

I am using System.Security.Cryptography.RijndaelManaged class in C#(.NET 3.5) to do encryption with settings: 我在C#(。NET 3.5)中使用System.Security.Cryptography.RijndaelManaged类对设置进行加密:

RijndaelManaged AesCrypto = new RijndaelManaged();
AesCrypto.BlockSize = 128;
AesCrypto.Mode = CipherMode.CBC;
CryptoStream CryptStream = new CryptoStream(memStream1,
    AesCrypto.CreateEncryptor(EncryptionKey1, EncryptionIV1),
                    CryptoStreamMode.Write);

And with 256 bit key and IV. 并带有256位密钥和IV。 I believe that results in AES256. 我相信会导致AES256。 Am I right? 我对吗?

Would there be any differences if I am using System.Security.Cryptography.AesManaged class? 如果我使用System.Security.Cryptography.AesManaged类,会有什么区别吗?

Also, I was thinking, we TRUST Microsoft implementation of AES, can this be verified, or maybe one should write his own implementation of AES? 另外,我当时在想,我们信任Microsoft的AES实现,可以对此进行验证,还是应该编写自己的AES实现?

About the differences between AesManaged and RijndaelManaged : 关于AesManagedRijndaelManaged之间的区别:

The AES algorithm is essentially the Rijndael symmetric algorithm with a fixed block size and iteration count. AES算法本质上是具有固定块大小和迭代计数的Rijndael对称算法。 This class functions the same way as the RijndaelManaged class but limits blocks to 128 bits and does not allow feedback modes. 该类的功能与RijndaelManaged类相同,但将块限制为128位,并且不允许反馈模式。

Taken from MSDN, here is the http://msdn.microsoft.com/en-us/library/system.security.cryptography.aesmanaged.aspx 来自MSDN,这里是http://msdn.microsoft.com/en-us/library/system.security.cryptography.aesmanaged.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM