public static string RSASignContent(string data, string privateKey, string signType) { return(signType switch { "RSA1" => SHA1WithRSA.Sign(data, privateKey), "RSA2" => SHA256WithRSA.Sign(data, privateKey), _ => SHA1WithRSA.Sign(data, privateKey), });
public static bool RSACheckContent(string data, string sign, string publicKey, string signType) { var key = RSAUtilities.GetRSAParametersFormPublicKey(publicKey); switch (signType) { case "RSA2": return(SHA256WithRSA.Verify(data, sign, key)); default: return(SHA1WithRSA.Verify(data, sign, key)); } }
public static string RSASignContent(string data, string privateKey, string signType) { var key = RSAUtilities.GetRSAParametersFormRsaPrivateKey(privateKey); switch (signType) { case "RSA2": return(SHA256WithRSA.Sign(data, key)); default: return(SHA1WithRSA.Sign(data, key)); } }
public static bool RSACheckContent(string data, string sign, string publicKey, string signType) { switch (signType) { case "RSA1": return(SHA1WithRSA.Verify(data, sign, publicKey)); case "RSA2": return(SHA256WithRSA.Verify(data, sign, publicKey)); default: return(SHA1WithRSA.Verify(data, sign, publicKey)); } }
public static string RSASignContent(string data, string privateKey, string signType) { switch (signType) { case "RSA1": return(SHA1WithRSA.Sign(data, privateKey)); case "RSA2": return(SHA256WithRSA.Sign(data, privateKey)); default: return(SHA1WithRSA.Sign(data, privateKey)); } }