Mega Code Archive

 
Categories / VB.Net Tutorial / Security
 

DSASignatureFormatter and DSACryptoServiceProvider

Imports System Imports System.Security.Cryptography Class DSASample     Shared Sub Main()         Try             Dim DSA As New DSACryptoServiceProvider()             Dim Hash As Byte() = {60, 4, 48, 102, 78, 97, 142, 201, 210, 12, 224, 93, 25, 42, 111, 117, 113, 114, 130, 135}             Dim DSAFormatter As New DSASignatureFormatter(DSA)             DSAFormatter.SetHashAlgorithm("SHA1")             Dim SignedHash As Byte() = DSAFormatter.CreateSignature(Hash)         Catch e As CryptographicException             Console.WriteLine(e.Message)         End Try     End Sub End Class