/// <summary>
/// 数字签名并返回BASE64编码的字符串
/// </summary>
/// <param name="contentForSign">待签名内容</param>
/// <param name="privateKeyFile">私钥文件路径</param>
/// <returns></returns>
internal static string Sign(string contentForSign, string privateKeyFile)
{
var rsa = CcbRsaCryptProvider.GetInstanceForSign(privateKeyFile);
var signData = rsa.SignData(Encoding.UTF8.GetBytes(contentForSign), new MD5CryptoServiceProvider());
return Convert.ToBase64String(signData);
} /// <summary>
/// 验证签名
/// </summary>
/// <param name="contentForSign">待签名内容</param>
/// <param name="signedData">签名内容</param>
/// <param name="publicKeyFile">公钥文件路径</param>
/// <returns>验证结果</returns>
internal static bool VerifySign(string contentForSign, string signedData, string publicKeyFile)
{
var rsaPub = CcbRsaCryptProvider.GetInstanceForVerifySign(publicKeyFile);
return rsaPub.VerifyData(Encoding.UTF8.GetBytes(contentForSign), new MD5CryptoServiceProvider(), Convert.FromBase64String(signedData));
}