//RSA签名 public static string messagesign(string message) { string priKeyFile = "\\CA\\root.p12";//默认目录位置,私钥 string privateKyeXml = RsaHelper.PrivateKeyXmlFromPKCS12(priKeyFile, ""); if (privateKyeXml == null) { return("0"); } string signvalue = RsaHelper.SenderHashAndSign(message, privateKyeXml); if (signvalue == null) { return("0"); } else { return(signvalue); } }
//RSA解密 public static string RSADecry(string message) { string priKeyFile = "\\CA\\root.p12";//默认目录位置,私钥 string privateKyeXml = RsaHelper.PrivateKeyXmlFromPKCS12(priKeyFile, ""); if (privateKyeXml == null) { return("0"); } string rsaDecrypted = RsaHelper.Decrypt(message, privateKyeXml); if (rsaDecrypted == null) { return("0"); } else { return(rsaDecrypted); } return("1"); }