示例#1
0
        public static ICryptoValue DecryptByPublicKey(byte[] cipherData, string publicKey, RsaKeyFormat format, bool fOEAP)
        {
            var key      = RsaKeyGenerator.GeneratePublicKey(publicKey, format);
            var function = Factory.Create(key);

            return(function.DecryptByPublicKey(cipherData));
        }
示例#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 SignByPublicKey(string originalText, string publicKey, RsaKeyFormat format, HashAlgorithmName hashAlgorithmName, RSASignaturePadding padding, Encoding encoding = null)
        {
            var key      = RsaKeyGenerator.GeneratePublicKey(publicKey, format);
            var function = Factory.Create(key);

            return(function.SignByPublicKey(originalText, hashAlgorithmName, padding, encoding));
        }
示例#4
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));
        }
示例#5
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));
        }
示例#6
0
        public static ISignValue SignByPublicKey(byte[] originalData, string publicKey, RsaKeyFormat format, HashAlgorithmName hashAlgorithmName, RSASignaturePadding padding)
        {
            var key      = RsaKeyGenerator.GeneratePublicKey(publicKey, format);
            var function = Factory.Create(key);

            return(function.SignByPublicKey(originalData, hashAlgorithmName, padding));
        }
示例#7
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));
        }
示例#8
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));
        }
示例#9
0
        public static ICryptoValue EncryptByPublicKey(byte[] originalData, string publicKey, RsaKeyFormat format, RSAEncryptionPadding padding)
        {
            var key      = RsaKeyGenerator.GeneratePublicKey(publicKey, format);
            var function = Factory.Create(key);

            return(function.EncryptByPublicKey(originalData, padding));
        }
示例#10
0
        public static ICryptoValue DecryptByPublicKey(string cipherText, string publicKey, RsaKeyFormat format, bool fOEAP, Encoding encoding = null)
        {
            var key      = RsaKeyGenerator.GeneratePublicKey(publicKey, format);
            var function = Factory.Create(key);

            return(function.DecryptByPublicKey(cipherText, encoding));
        }
示例#11
0
        public static ICryptoValue EncryptByPublicKey(string originalText, string publicKey, RsaKeyFormat format, RSAEncryptionPadding padding, Encoding encoding = null)
        {
            var key      = RsaKeyGenerator.GeneratePublicKey(publicKey, format);
            var function = Factory.Create(key);

            return(function.EncryptByPublicKey(originalText, padding, encoding));
        }
示例#12
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));
        }
示例#13
0
 public static IRSA CreateWithPrivateKey(string key, RsaKeyFormat keyFormat) => new RsaFunction(RsaKeyGenerator.GeneratePrivateKey(key, keyFormat));
示例#14
0
 public static IRSA CreateWithKeyInJson(string key) => new RsaFunction(RsaKeyGenerator.GenerateInJson(key));
示例#15
0
 public static IRSA CreateWithPrivateKeyFromFile(string certFile, string password) => new RsaFunction(RsaKeyGenerator.GeneratePrivateKeyFromFile(certFile, password));
示例#16
0
 public static IRSA CreateWithPublicKeyFromFile(string certFile) => new RsaFunction(RsaKeyGenerator.GeneratePublicKeyFromFile(certFile));
示例#17
0
 public static IRSA CreateWithPrivateKeyInPkcs8(string key) => new RsaFunction(RsaKeyGenerator.GeneratePrivateKeyInPkcs8(key));
示例#18
0
 public static IRSA CreateWithPublicKeyInPkcs1(string key) => new RsaFunction(RsaKeyGenerator.GeneratePublicKeyInPkcs1(key));