我正在尝试在具有 VB .net 中匹配版本的嵌入式平台上实现 AES 加密。嵌入式平台具有硬件 AES 加速功能,结果与http://testprotect.com/appendix/AEScalc相同。我四处搜索并使用以下 VB .net 代码尝试做同样的事情,但得到不同的结果。
Dim AES As New System.Security.Cryptography.RijndaelManaged
Dim key() As Byte = New Byte() {&HDE, &HAD, &HBE, &HEF, &HA5, &HF4, &H56, &H12, &HDE, &HAD, &HBA, &HAB, &H1, &H92, &H83, &H74}
AES.Key = key
AES.KeySize = 128
AES.BlockSize = 128
AES.Padding = Security.Cryptography.PaddingMode.None
AES.Mode = Security.Cryptography.CipherMode.ECB
Dim DESEncrypter As System.Security.Cryptography.ICryptoTransform = AES.CreateEncryptor
Dim input() As Byte = New Byte() {&H12, &H34, &H56, &H78, &H9A, &HBC, &HDE, &HF0, &H24, &H68, &HAC, &HE0, &H78, &H94, &H56, &H12}
Dim enc() As Byte = DESEncrypter.TransformFinalBlock(input, 0, input.Length)
我的输入是:
键:0xdeadbeefa5f45612deadbaab01928374
输入:0x123456789ABCDEF02468ACE078945612
网站和嵌入式平台给出的输出:
0x2b9481a0f7b32f1088407d8834c3dc4c
VB .net 给出的输出:
0x49ca99ee420a82acd72f1532141385fd
谁能告诉我我在 VB .net 中做错了什么?谢谢。