コード例 #1
0
 public EncryptingValueConverter(
     IValueConverter decoratedValueConverter,
     IEncryptionAlgorithmFactory encryptionAlgorithmFactory)
 {
     _decoratedValueConverter = decoratedValueConverter;
     _encryptionAlgorithm     = encryptionAlgorithmFactory.GetAlgorithm(decoratedValueConverter.Type);
 }
コード例 #2
0
 public EncryptingValueConverter(
     IValueConverter decoratedValueConverter,
     IEncryptionAlgorithmFactory encryptionAlgorithmFactory)
 {
     _decoratedValueConverter = decoratedValueConverter;
     _encryptionAlgorithm = encryptionAlgorithmFactory.GetAlgorithm(decoratedValueConverter.Type);
 }
コード例 #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;
        }
コード例 #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;
        }
コード例 #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);
        }
コード例 #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);
        }