本文整理汇总了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