Exemplo n.º 1
0
        public string Encrypt(string value, string masterKey)
        {
            if (_configuration == null)
            {
                throw new EncryptionConfigurationException("Invalid configuration set in TripleDESEncryptionStrategy");
            }

            return(CipherUtility.Encrypt <TripleDESAlgorithm>(value, masterKey, _configuration.EncryptionSalt));
        }
Exemplo n.º 2
0
        public string Decrypt(string text, string masterKey)
        {
            if (_configuration == null)
            {
                throw new EncryptionConfigurationException("Invalid configuration set in TripleDESEncryptionStrategy");
            }

            try
            {
                return(CipherUtility.Decrypt <TripleDESAlgorithm>(text, masterKey, _configuration.EncryptionSalt));
            }
            catch (System.Security.Cryptography.CryptographicException cryptographicException)
            {
                throw new EncryptionStrategyException(cryptographicException.Message);
            }
        }