問題描述
根據我的閱讀,我不確定 AES 是一種可以使用不同長度密鑰的單一標準化算法,還是一系列類似算法?我的意思是,如果我發現任何 2 個采用 128 位密鑰的 AES 實現,我是否應該確信它們會以相同的方式工作(排除錯誤)?
From my reading I am not sure if AES is a single, standardized algorithm that can work with different length keys, or a family of similar algorithms? What I mean is if I find any 2 AES implementations taking a 128-bit key, should I be confident they will work identically (barring bugs)?
特別是在.Net/C#中,我很困惑為什么抽象基類System.Security.Cryptography.Aes
有兩種實現:System.Security.Cryptography.AesCryptoServiceProvider
&System.Security.Cryptography.AesManaged
.
Specifically in .Net/C#, I was confused why there are two implementations of abstract base class System.Security.Cryptography.Aes
: System.Security.Cryptography.AesCryptoServiceProvider
& System.Security.Cryptography.AesManaged
.
然后似乎 AES 和 Rijndael 之間存在區別/重疊,.NET 有 Rijndael
和 RijndaelManaged
類,以及 RijndaelManagedTransform
Then there seems to be distinction/overlap between AES and Rijndael, .NET has Rijndael
and RijndaelManaged
classes, as well as RijndaelManagedTransform
所有這些之間有什么區別?我注意到 AES 類似乎只存在于 .NET 3.5 之后,而 Rijndael 從 1.0 開始就存在
What's the differences between all of these? I notice AES classes seem to only exist since .NET 3.5 whereas Rijndael has been around since 1.0
對不起,如果這些是愚蠢的問題,我是加密的新手,而不是安全散列函數.
Sorry if these are dumb questions, I'm new to crypto other than secure hashing functions.
推薦答案
AES,高級加密標準,定義在 FIPS PUB 197 三種對稱分組密碼:AES-128、AES-192 和 AES-256.所有三種算法都由 Rijndael 算法的特定參數選擇定義.
AES, the Advanced Encryption Standard, defines in FIPS PUB 197 three symmetric block-ciphers: AES-128, AES-192 and AES-256. All three algorithms are defined by specific parameter-choices for the Rijndael algorithm.
AES-128-encryption 是一個函數(密鑰、數據)->(加密).Rijndael-encryption 是一個函數 (key, data, block-size, key-size) -> (encryption).
AES-128-encryption is a function (key, data) -> (encryption). Rijndael-encryption is a function (key, data, block-size, key-size) -> (encryption).
AesCryptoServiceProvider
使用底層 Windows CryptoAPI 來執行加密.AesManaged
在純托管代碼中執行加密.RijndaelManaged
支持所有參數選擇(在純托管代碼中也是如此).
AesCryptoServiceProvider
uses the underlying Windows CryptoAPI to perform the encryption.
AesManaged
performs the encryption in pure managed code. RijndaelManaged
supports the full range of parameter-choices (also in pure managed code).
使用 AesCryptoServiceProvider
的優勢包括提高速度的潛力以及 CryptoAPI 已通過 FIPS 認證(在某些版本的 Windows 上).
Advantages to using AesCryptoServiceProvider
include potential for higher speed and the fact that CryptoAPI is FIPS certified (on certain versions of Windows).
AesManaged
的優點包括可移植性(并非所有版本的 Windows 都支持 AesCryptoServiceProvider
).
Advantages to AesManaged
include portability (AesCryptoServiceProvider
is not supported on all versions of Windows).
RijndaelManaged
的唯一優勢是它在 .NET 框架的早期版本中受支持 - 我從未見過有人使用非 AES 參數選擇.
The only advantage to RijndaelManaged
is that it is supported in early versions of the .NET framework - I haven't ever seen anyone use the non-AES parameter-choices.
這篇關于AES 加密和 C#的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!