Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 13
0
 public static IRSA CreateWithPrivateKey(string key, RsaKeyFormat keyFormat) => new RsaFunction(RsaKeyGenerator.GeneratePrivateKey(key, keyFormat));
Exemplo n.º 14
0
 public static IRSA CreateWithKeyInJson(string key) => new RsaFunction(RsaKeyGenerator.GenerateInJson(key));
Exemplo n.º 15
0
 public static IRSA CreateWithPrivateKeyFromFile(string certFile, string password) => new RsaFunction(RsaKeyGenerator.GeneratePrivateKeyFromFile(certFile, password));
Exemplo n.º 16
0
 public static IRSA CreateWithPublicKeyFromFile(string certFile) => new RsaFunction(RsaKeyGenerator.GeneratePublicKeyFromFile(certFile));
Exemplo n.º 17
0
 public static IRSA CreateWithPrivateKeyInPkcs8(string key) => new RsaFunction(RsaKeyGenerator.GeneratePrivateKeyInPkcs8(key));
Exemplo n.º 18
0
 public static IRSA CreateWithPublicKeyInPkcs1(string key) => new RsaFunction(RsaKeyGenerator.GeneratePublicKeyInPkcs1(key));