C# SM2签名方法,签名方法

百度上搜索的基本都是加密方法,签名方法没有.
花钱下载了几个CSDN的资源,全是一样的最早的看到了2016年的
图片说明

死在了这一关

public static void Test_sm2_sign(SM2 sm2)
{
System.Console.Out.WriteLine("\n--- 01 数字签名算法 ----------------------------");
bool sm2Test = sm2.sm2Test;

        BigInteger test_d = null;
        ECPoint test_p = null;

        if (!sm2Test)
        {
            System.Console.Out.WriteLine("密钥对产生 开始时间 = " + System.DateTime.Now.Ticks);
            AsymmetricCipherKeyPair keypair = null;
            for (int i = 0; i < 1; i++)
                keypair = sm2.ecc_key_pair_generator.GenerateKeyPair();
            System.Console.Out.WriteLine("密钥对产生 结束时间 = " + System.DateTime.Now.Ticks);
            ECPrivateKeyParameters ecpriv = (ECPrivateKeyParameters)keypair.Private;
            ECPublicKeyParameters ecpub = (ECPublicKeyParameters)keypair.Public;
            System.Console.Out.WriteLine("密钥对(D,x,y)= \n" + ecpriv.D.ToString(16));
            System.Console.Out.WriteLine(ecpub.Q.X.ToBigInteger().ToString(16));
            System.Console.Out.WriteLine(ecpub.Q.Y.ToBigInteger().ToString(16));

            test_d = ecpriv.D;
            test_p = ecpub.Q;
        }
        else
        {
          test_d = new BigInteger("00C61B24016BBB469EAC899238B40F07B428CA1F30CB1D6702E6973854E80913CC", 16);
            //test_d = new BigInteger("128B2FA8BD433C6C068C8D803DFF79792A519A55171B1B650C23661D15897263", 16);
            System.Console.Out.WriteLine("测试密钥对(D,x,y) = \n" + test_d.ToString(16));
            test_p = sm2.ecc_point_g.Multiply(test_d);
            System.Console.Out.WriteLine("---------------------------------------------------");
            System.Console.Out.WriteLine("publicKey = " + test_p.X.ToBigInteger().ToString());
            System.Console.Out.WriteLine("publicKey = " + test_p.Y.ToBigInteger().ToString());
            System.Console.Out.WriteLine("---------------------------------------------------");
            System.Console.Out.WriteLine("publicKey = " + test_p.Curve.ToString());
            System.Console.Out.WriteLine("---------------------------------------------------");
            System.Console.Out.WriteLine("publicKey = " + test_p.ToString());
            System.Console.Out.WriteLine("---------------------------------------------------");

        }

        System.String msg = "{\"projectNo\":\"98000001\",\"feePkgPrjSrlNo\":\"00200\"}";
        Com.Itrus.Crypto.SM2.SM2Result sm2Ret = new Com.Itrus.Crypto.SM2.SM2Result();

        SM3Digest sm3 = new SM3Digest();

        byte[] z = sm2.Sm2GetZ(Encoding.Default.GetBytes(""), test_p);
        sm3.BlockUpdate(z, 0, z.Length);

        byte[] p = Encoding.Default.GetBytes(msg);
        sm3.BlockUpdate(p, 0, p.Length);

        byte[] md = new byte[32];
        sm3.DoFinal(md, 0);

        sm2.Sm2Sign(md, test_d, test_p, sm2Ret);
        sm2.Sm2Verify(md, test_p, sm2Ret.r, sm2Ret.s, sm2Ret);

        System.Console.Out.WriteLine("签名结果(r,s) = \n" + sm2Ret.r.ToString(16));
        System.Console.Out.WriteLine(sm2Ret.s.ToString(16));
        System.Console.Out.WriteLine("---------------------------------------------------");

        System.Console.Out.WriteLine("结果 = " + sm2Ret.r.Add(sm2Ret.s).ToString(16));

        System.Console.Out.WriteLine("---------------------------------------------------");
        System.Console.Out.WriteLine("验签结果 R = \n" + sm2Ret.R.ToString(16));
        if (sm2Ret.r.Equals(sm2Ret.R))
        {
            System.Console.Out.WriteLine("\n签名结果验证通过!r == R\n");
        }
        else
        {
            System.Console.Out.WriteLine("\n签名结果验证失败!r != R\n");
        }
        System.Console.Out.WriteLine("--- 02 数字签名算法 ----------------------------");
    }

            知道了r
            知道了s

            始终不明白,国家公开算法([链接](http://c.gb688.cn/bzgk/gb/showGb?type=online&hcno=6F1FAEB62F9668F25F38E0BF0291D4AC "")

)里的 sign=(r,s).

            怎么通过r,s运算出一个string结果来

https://blog.csdn.net/weixin_43939128/article/details/104571472