本文整理汇总了VB.NET中System.Security.Cryptography.SymmetricAlgorithm.GenerateIV方法的典型用法代码示例。如果您正苦于以下问题:VB.NET SymmetricAlgorithm.GenerateIV方法的具体用法?VB.NET SymmetricAlgorithm.GenerateIV怎么用?VB.NET SymmetricAlgorithm.GenerateIV使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Security.Cryptography.SymmetricAlgorithm
的用法示例。
在下文中一共展示了SymmetricAlgorithm.GenerateIV方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: SymmetricAlgorithm.GenerateIV()
' 导入命名空间
Imports System.Security.Cryptography
Imports System.Text
Imports System.IO
Imports System
Imports Microsoft.VisualBasic.ControlChars
Public Class SymKey
Public Shared Sub Main(ByVal CmdArgs() As String)
Dim algo() As String = {"DES", "RC2", "Rijndael", "TripleDES"}
Dim keyStringDeclare As StringBuilder = New StringBuilder
Dim ivz As StringBuilder = New StringBuilder
keyStringDeclare.Append("Dim b64Keys() As String = { _" + VbCrLf)
ivz.Append(vbCrLf + "Dim b64IVs() As String = { _" + vbCrLf)
Dim comma As String = ", _" + vbCrLf
For i As Integer = 0 To 3
Dim sa As SymmetricAlgorithm = SymmetricAlgorithm.Create(algo(i))
sa.GenerateIV()
sa.GenerateKey()
Dim Key As String
Dim IV As String
Key = Convert.ToBase64String(sa.Key)
IV = Convert.ToBase64String(sa.IV)
keyStringDeclare.AppendFormat(Tab + """" + Key + """" + comma)
ivz.AppendFormat(Tab + """" + IV + """" + comma)
If i = 2 Then comma = " "
Next i
keyStringDeclare.Append("}")
ivz.Append("}")
Console.WriteLine(keyStringDeclare.ToString())
Console.WriteLine(ivz.ToString())
End Sub
End Class