/// <summary>
        ///  使用私钥进行签名
        /// </summary>
        /// <param name="macdata">签名原串</param>
        /// <param name="privateKey">私钥</param>
        /// <returns></returns>
        public static byte[] Sign(byte[] macdata, AsymmetricKeyParameter privateKey)
        {
            Org.BouncyCastle.Crypto.Signers.SM2Signer signer = new Org.BouncyCastle.Crypto.Signers.SM2Signer();
            signer.Init(true, privateKey);
            signer.BlockUpdate(macdata, 0, macdata.Length);
            byte[] sign = signer.GenerateSignature();
            return(sign);

            Asn1Sequence sequence = Asn1Sequence.GetInstance(sign);
            DerInteger   r        = (DerInteger)sequence[0];
            DerInteger   s        = (DerInteger)sequence[1];

            BigInteger[] bigs = new BigInteger[] { r.Value, s.Value };

            byte[] bs;
            using (MemoryStream ms = new MemoryStream())
            {
                DerSequenceGenerator seq = new DerSequenceGenerator(ms);
                seq.AddObject(new DerInteger(bigs[0]));
                seq.AddObject(new DerInteger(bigs[1]));
                seq.Close();
                bs = ms.ToArray();
            }
            return(bs);
        }
        /// <summary>
        /// 使用公钥对待验签数据进行验签
        /// </summary>
        /// <param name="data">参与验签字符</param>
        /// <param name="signature">要验签的签名串</param>
        /// <param name="pkInfo">公钥信息</param>
        /// <returns>返回验签结果</returns>
        public static bool VerifyData(byte[] data, byte[] signature, AsymmetricKeyParameter pkInfo)
        {
            Org.BouncyCastle.Crypto.Signers.SM2Signer signer = new Org.BouncyCastle.Crypto.Signers.SM2Signer();

            signer.Init(false, pkInfo);
            signer.BlockUpdate(data, 0, data.Length);
            return(signer.VerifySignature(signature));
        }