Example #1
0
 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),
     });
Example #2
0
        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));
            }
        }
Example #3
0
        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));
            }
        }
Example #4
0
        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));
            }
        }
Example #5
0
        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));
            }
        }