Exemplo n.º 1
0
        private bool IsValid(IHeaderDictionary headerDictionary)
        {
            string clientKey =
                headerDictionary[_config.ClientKeyHeader];

            if (String.IsNullOrWhiteSpace(clientKey))
            {
                return(false);
            }

            string clientSalt =
                headerDictionary[_config.SaltHeaderKey];

            if (String.IsNullOrWhiteSpace(clientSalt))
            {
                return(false);
            }

            var encryptionService = new EncryptionService(clientKey,
                                                          clientSalt,
                                                          Convert.ToInt32(_config.HashBytesNum));

            return(encryptionService.Compare(_config.Key)
                   == EncryptionService.EncryptComp.Equal);
        }