Beispiel #1
0
        public static ICryptoValue Encrypt(AesTypes type, byte[] originalBytes, byte[] pwd, byte[] iv, byte[] salt)
        {
            var key      = Factory.GenerateKey(type, pwd, iv);
            var function = Factory.Create(type, key);

            return(function.Encrypt(originalBytes, salt));
        }
Beispiel #2
0
        public static ICryptoValue Decrypt(AesTypes type, byte[] cipherBytes, byte[] pwd, byte[] iv, byte[] salt)
        {
            var key      = Factory.GenerateKey(type, pwd, iv);
            var function = Factory.Create(type, key);

            return(function.Decrypt(cipherBytes, salt));
        }
Beispiel #3
0
        public static ICryptoValue Encrypt(byte[] originalBytes, byte[] pwd, byte[] iv)
        {
            var key      = Factory.GenerateKey(AesTypes.Aes256, pwd, iv);
            var function = Factory.Create(AesTypes.Aes256, key);

            return(function.Encrypt(originalBytes));
        }
Beispiel #4
0
        public static ICryptoValue Decrypt(byte[] cipherBytes, byte[] pwd, byte[] iv)
        {
            var key      = Factory.GenerateKey(AesTypes.Aes256, pwd, iv);
            var function = Factory.Create(AesTypes.Aes256, key);

            return(function.Decrypt(cipherBytes));
        }
Beispiel #5
0
        public static ICryptoValue Decrypt(string cipherText, string pwd, string iv, Encoding encoding = null)
        {
            encoding = encoding.SafeEncodingValue();
            var key      = Factory.GenerateKey(AesTypes.Aes256, pwd, iv, encoding);
            var function = Factory.Create(AesTypes.Aes256, key);

            return(function.Decrypt(cipherText, encoding));
        }
Beispiel #6
0
        public static ICryptoValue Encrypt(AesTypes type, string originalText, string pwd, string iv, string salt, Encoding encoding = null)
        {
            encoding = encoding.SafeEncodingValue();
            var key      = Factory.GenerateKey(type, pwd, iv, encoding);
            var function = Factory.Create(type, key);

            return(function.Encrypt(originalText, salt, encoding));
        }
Beispiel #7
0
        public static ICryptoValue Decrypt(AesTypes type, string cipherText, string pwd, string iv, string salt, CipherTextTypes cipherTextType, Encoding encoding = null, Func <string, byte[]> customConverter = null)
        {
            encoding = encoding.SafeEncodingValue();
            var key      = Factory.GenerateKey(type, pwd, iv, encoding);
            var function = Factory.Create(type, key);

            return(function.Decrypt(cipherText, salt, cipherTextType, encoding, customConverter));
        }
Beispiel #8
0
 public static IAES Create(AesTypes type, AesKey key) => Factory.Create(type, key);
Beispiel #9
0
 public static IAES Create(AesTypes type, byte[] pwd, byte[] iv) => Factory.Create(type, pwd, iv);
Beispiel #10
0
 public static IAES Create(AesTypes type, string pwd, string iv, Encoding encoding = null) => Factory.Create(type, pwd, iv, encoding);
Beispiel #11
0
 public static IAES Create(AesTypes type) => Factory.Create(type);
Beispiel #12
0
 public static IAES Create() => Factory.Create();
Beispiel #13
0
 public static AesKey GenerateKey(AesTypes type, byte[] pwd, byte[] iv) => Factory.GenerateKey(type, pwd, iv);
Beispiel #14
0
 public static AesKey GenerateKey(AesTypes type, string pwd, string iv, Encoding encoding) => Factory.GenerateKey(type, pwd, iv, encoding);
Beispiel #15
0
 public static AesKey GenerateKey(AesTypes type = AesTypes.Aes256) => Factory.GenerateKey(type);