【发布时间】:2014-01-11 02:44:23
【问题描述】:
我试图理解为什么下面的代码也不需要您生成 IV 密钥?代码来自:
http://msdn.microsoft.com/en-us/library/sb7w85t6(v=vs.85).aspx
Dim key As RijndaelManaged = Nothing
Try
' Create a new Rijndael key.
key = New RijndaelManaged()
我看到了这个示例代码,但需要您手动生成两个密钥?
代码来自:
http://msdn.microsoft.com/en-us/library/System.Security.Cryptography.RijndaelManaged(v=vs.110).aspx
Class RijndaelExample
Public Shared Sub Main()
Try
Dim original As String = "Here is some data to encrypt!"
' Create a new instance of the RijndaelManaged
' class. This generates a new key and initialization
' vector (IV).
Using myRijndael As New RijndaelManaged()
myRijndael.GenerateKey()
myRijndael.GenerateIV()
我还计划将密钥硬编码到源代码中(我知道这不是最安全的)......我如何实际存储这些......看起来每次应用程序打开时它都会生成一个新密钥。
【问题讨论】: