[VB6 equivalent: RSA_DecodeMsg
]
Dim abData() As Byte Dim abBlock() As Byte Dim abDigest() As Byte Dim abDigInfo() As Byte Dim nBlockLen As Integer ' 0. Create an encoded test block ready for for signing abData = System.Text.Encoding.Default.GetBytes("abc") nBlockLen = 64 abBlock = Rsa.EncodeMsgForSignature(nBlockLen, abData, HashAlgorithm.Sha1) Console.WriteLine("BLOCK =" & Cnv.ToHex(abBlock)) ' 1. Extract the message digest =SHA1("abc") abDigest = Rsa.DecodeDigestForSignature(abBlock) If abDigest.Length = 0 Then Console.WriteLine("Decryption Error") Exit Sub End If Console.WriteLine("Message digest is " & abDigest.Length & " bytes long") Console.WriteLine("HASH =" & Cnv.ToHex(abDigest)) ' 2. Extract the full DigestInfo data abDigInfo = Rsa.DecodeDigestForSignature(abBlock, True) If abDigInfo.Length = 0 Then Console.WriteLine("Decryption Error") Exit Sub End If Console.WriteLine("DigestInfo is " & abDigInfo.Length & " bytes long") Console.WriteLine("DIGINFO=" & Cnv.ToHex(abDigInfo))
See Also:
Rsa.DecodeDigestForSignature Method
Rsa.DecodeMsgForEncryption Method
Rsa.DecodeMsgIso9796 Method