本文整理匯總了VB.NET中System.Security.Cryptography.ECDsaCng類的典型用法代碼示例。如果您正苦於以下問題:VB.NET ECDsaCng類的具體用法?VB.NET ECDsaCng怎麽用?VB.NET ECDsaCng使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了ECDsaCng類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: Alice
' 導入命名空間
Imports System.IO
Imports System.Security.Cryptography
Imports System.Text
Class Alice
Public Shared Sub Main(ByVal args() As String)
Dim bob As New Bob()
If (True) Then
Using dsa As New ECDsaCng()
dsa.HashAlgorithm = CngAlgorithm.Sha256
bob.key = dsa.Key.Export(CngKeyBlobFormat.EccPublicBlob)
Dim data() As Byte = {21, 5, 8, 12, 207}
Dim signature As Byte() = dsa.SignData(data)
bob.Receive(data, signature)
End Using
End If
End Sub
End Class
Public Class Bob
Public key() As Byte
Public Sub Receive(ByVal data() As Byte, ByVal signature() As Byte)
Using ecsdKey As New ECDsaCng(CngKey.Import(key, CngKeyBlobFormat.EccPublicBlob))
If ecsdKey.VerifyData(data, signature) Then
Console.WriteLine("Data is good")
Else
Console.WriteLine("Data is bad")
End If
End Using
End Sub
End Class