public static void V_Test_RSA_DecodeMsg() { Console.WriteLine("Testing RSA_DecodeMsg ..."); byte[] abData = null; byte[] abBlock = null; byte[] abDigest = null; byte[] abDigInfo = null; //'Dim nDataLen As Integer int nBlockLen = 0; // 0. Create an encoded test block ready for for signing abData = System.Text.Encoding.Default.GetBytes("abc"); //'nDataLen = UBound(abData) - LBound(abData) + 1 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) { Console.WriteLine("Decryption Error"); return; } 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) { Console.WriteLine("Decryption Error"); return; } Console.WriteLine("DigestInfo is " + abDigInfo.Length + " bytes long"); Console.WriteLine("DIGINFO=" + Cnv.ToHex(abDigInfo)); }