************************使用方法******************************
Dim encBytes() As Byte = encryptAesECB(Encoding.UTF8.GetBytes(“加密数据”), Encoding.UTF8.GetBytes(key))
************************函数定义******************************
Private Function encryptAesECB(ByVal toEncryptBytes() As Byte, ByVal keyArray() As Byte)
Dim rDel As RijndaelManaged = New RijndaelManaged
rDel.Key = keyArray
rDel.Mode = CipherMode.ECB
rDel.Padding = PaddingMode.PKCS7
Dim cTransform As ICryptoTransform = rDel.CreateEncryptor()
encryptAesECB = cTransform.TransformFinalBlock(toEncryptBytes, 0, toEncryptBytes.Length)
End Function