示例#1
0
        public static bool VerifyByPrivateKey(byte[] originalData, byte[] signature, string privateKey, RsaKeyFormat format, HashAlgorithmName hashAlgorithmName, RSASignaturePadding padding)
        {
            var key      = RsaKeyGenerator.GeneratePrivateKey(privateKey, format);
            var function = Factory.Create(key);

            return(function.VerifyByPrivateKey(originalData, signature, hashAlgorithmName, padding));
        }
示例#2
0
        public static bool VerifyByPrivateKey(string originalText, string signature, string privateKey, RsaKeyFormat format, HashAlgorithmName hashAlgorithmName, RSASignaturePadding padding, Encoding encoding = null)
        {
            var key      = RsaKeyGenerator.GeneratePrivateKey(privateKey, format);
            var function = Factory.Create(key);

            return(function.VerifyByPrivateKey(originalText, signature, hashAlgorithmName, padding, encoding));
        }
示例#3
0
        public static ISignValue SignByPrivateKey(byte[] originalData, string privateKey, RsaKeyFormat format, HashAlgorithmName hashAlgorithmName)
        {
            var key      = RsaKeyGenerator.GeneratePrivateKey(privateKey, format);
            var function = Factory.Create(key);

            return(function.SignByPrivateKey(originalData, hashAlgorithmName));
        }
示例#4
0
        public static ISignValue SignByPrivateKey(string originalText, string privateKey, RsaKeyFormat format, HashAlgorithmName hashAlgorithmName, Encoding encoding = null)
        {
            var key      = RsaKeyGenerator.GeneratePrivateKey(privateKey, format);
            var function = Factory.Create(key);

            return(function.SignByPrivateKey(originalText, hashAlgorithmName, encoding));
        }
示例#5
0
        public static ICryptoValue DecryptByPrivateKey(string cipherText, string privateKey, RsaKeyFormat format, RSAEncryptionPadding padding, Encoding encoding = null)
        {
            var key      = RsaKeyGenerator.GeneratePrivateKey(privateKey, format);
            var function = Factory.Create(key);

            return(function.DecryptByPrivateKey(cipherText, padding, encoding));
        }
示例#6
0
        public static ICryptoValue DecryptByPrivateKey(byte[] cipherData, string privateKey, RsaKeyFormat format, RSAEncryptionPadding padding)
        {
            var key      = RsaKeyGenerator.GeneratePrivateKey(privateKey, format);
            var function = Factory.Create(key);

            return(function.DecryptByPrivateKey(cipherData, padding));
        }
示例#7
0
        public static ICryptoValue EncryptByPrivateKey(string originalText, string privateKey, RsaKeyFormat format, Encoding encoding = null)
        {
            var key      = RsaKeyGenerator.GeneratePrivateKey(privateKey, format);
            var function = Factory.Create(key);

            return(function.EncryptByPrivateKey(originalText, encoding));
        }
示例#8
0
        public static ICryptoValue EncryptByPrivateKey(byte[] originalData, string privateKey, RsaKeyFormat format)
        {
            var key      = RsaKeyGenerator.GeneratePrivateKey(privateKey, format);
            var function = Factory.Create(key);

            return(function.EncryptByPrivateKey(originalData));
        }
示例#9
0
 public static IRSA CreateWithPrivateKey(string key, RsaKeyFormat keyFormat) => new RsaFunction(RsaKeyGenerator.GeneratePrivateKey(key, keyFormat));