/// <summary> /// 生成签名和密文 /// </summary> /// <param name="signature">签名</param> /// <param name="cipherText">明文 签名后 密文</param> public static void ToSign(out string signature, ref string cipherText) { var sec = appsecret.EnCode(SIC_Exten.CodeType.MD5).ToLower(); cipherText = DESEncryption.Encrypt(cipherText, appkey); signature = (cipherText + sec).EnCode(SIC_Exten.CodeType.MD5).ToLower(); }
/// <summary> /// 验证签名 /// </summary> /// <param name="signature"></param> /// <param name="cipherText"></param> /// <returns></returns> public static bool CheckSign(string signature, ref string cipherText) { var sec = appsecret.EnCode(SIC_Exten.CodeType.MD5).ToLower(); var sign = (DESEncryption.Encrypt(cipherText, appkey) + sec).EnCode(SIC_Exten.CodeType.MD5).ToLower(); if (sign == signature) { return(true); } return(false); }