Exemplo n.º 1
0
 public EncryptingValueConverter(
     IValueConverter decoratedValueConverter,
     IEncryptionAlgorithmFactory encryptionAlgorithmFactory)
 {
     _decoratedValueConverter = decoratedValueConverter;
     _encryptionAlgorithm     = encryptionAlgorithmFactory.GetAlgorithm(decoratedValueConverter.Type);
 }
 public EncryptingValueConverter(
     IValueConverter decoratedValueConverter,
     IEncryptionAlgorithmFactory encryptionAlgorithmFactory)
 {
     _decoratedValueConverter = decoratedValueConverter;
     _encryptionAlgorithm = encryptionAlgorithmFactory.GetAlgorithm(decoratedValueConverter.Type);
 }
Exemplo n.º 3
0
        public string Encrypt(
            string plaintext,
            Type declaringType,
            bool encryptionEnabled,
            IEncryptionAlgorithmFactory encryptionAlgorithmFactory)
        {
            if (plaintext == null)
            {
                return null;
            }

            return
                encryptionEnabled
                    ? (encryptionAlgorithmFactory ?? EncryptionAlgorithmFactory.Current).GetAlgorithm(declaringType).Encrypt(plaintext)
                    : plaintext;
        }
Exemplo n.º 4
0
        public string Decrypt(
            string ciphertext,
            Type declaringType,
            bool encryptionEnabled,
            IEncryptionAlgorithmFactory encryptionAlgorithmFactory)
        {
            if (ciphertext == null)
            {
                return null;
            }

            return
                encryptionEnabled
                    ? (encryptionAlgorithmFactory ?? EncryptionAlgorithmFactory.Current).GetAlgorithm(declaringType).Decrypt(ciphertext)
                    : ciphertext;
        }
Exemplo n.º 5
0
        public string Encrypt(
            string plaintext,
            Type declaringType,
            bool encryptionEnabled,
            IEncryptionAlgorithmFactory encryptionAlgorithmFactory)
        {
            if (plaintext == null)
            {
                return(null);
            }

            return
                (encryptionEnabled
                    ? (encryptionAlgorithmFactory ?? EncryptionAlgorithmFactory.Current).GetAlgorithm(declaringType).Encrypt(plaintext)
                    : plaintext);
        }
Exemplo n.º 6
0
        public string Decrypt(
            string ciphertext,
            Type declaringType,
            bool encryptionEnabled,
            IEncryptionAlgorithmFactory encryptionAlgorithmFactory)
        {
            if (ciphertext == null)
            {
                return(null);
            }

            return
                (encryptionEnabled
                    ? (encryptionAlgorithmFactory ?? EncryptionAlgorithmFactory.Current).GetAlgorithm(declaringType).Decrypt(ciphertext)
                    : ciphertext);
        }