-1
我想了解爲什麼直接下面的代碼不需要你生成一個IV密鑰?代碼爲:Rijndael加密密鑰
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()
我看到這個樣本代碼,但需要你manaually產生兩個鍵?
代碼爲:
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()
我也打算硬編碼的鑰匙插入源(我知道這是不是最安全的)......實際上,我怎麼存儲這些..它看起來每次應用程序打開時都會生成一個新的密鑰。