Exemple #1
0
        //RSA验证签名
        public static string messagesigncheck(string messagesign, string signvalue)
        {
            string pubKeyFile   = "\\CA\\root-cert.cer";//默认目录位置,公钥
            string publicKeyXml = RsaHelper.PublicKeyXmlFromCer(pubKeyFile, "");

            if (publicKeyXml == null)
            {
                return("0");
            }
            bool checkresult = RsaHelper.ReceiverVerifyHash(messagesign, signvalue, publicKeyXml);

            if (checkresult)
            {
                return("1");
            }
            else
            {
                return("0");
            }
        }
Exemple #2
0
        //RSA加密
        public static string RSAEncry(string message)
        {
            string pubKeyFile   = "\\CA\\root-cert.cer";//默认目录位置,公钥
            string publicKeyXml = RsaHelper.PublicKeyXmlFromCer(pubKeyFile, "");

            if (publicKeyXml == null)
            {
                return("0");
            }
            string rsaEncrypted = RsaHelper.Encrypt(message, publicKeyXml);

            if (rsaEncrypted == null)
            {
                return("0");
            }
            else
            {
                return(rsaEncrypted);
            }
            return("1");
        }