protected override string DoReadContent(string path, IDecryptionAlgorithm decryptionAlgorithm)
        {
            var encryptedContent   = ReadContent(path);
            var decryptedAlgorithm = decryptionAlgorithm.Decrypt(encryptedContent);

            return(decryptedAlgorithm);
        }
Esempio n. 2
0
 public T ReadContent(string path, IDecryptionAlgorithm decryptionAlgorithm)
 {
     _pathValidations.ThrowWhenInvalid(path);
     if (decryptionAlgorithm == null)
     {
         throw new ArgumentNullException(nameof(decryptionAlgorithm));
     }
     return(DoReadContent(path, decryptionAlgorithm));
 }
        protected override JsonDocument DoReadContent(string path, IDecryptionAlgorithm decryptionAlgorithm)
        {
            var text = _fileSystem.File.ReadAllText(path);

            var decryptedContent = decryptionAlgorithm.Decrypt(text);

            try
            {
                var document = JsonDocument.Parse(decryptedContent);
                return(document);
            }
            catch (JsonException)
            {
                return(null);
            }
        }
Esempio n. 4
0
        protected override XDocument DoReadContent(string path, IDecryptionAlgorithm decryptionAlgorithm)
        {
            var encryptedContent = _fileSystem.File.ReadAllText(path);
            var decryptedContent = decryptionAlgorithm.Decrypt(encryptedContent);

            try
            {
                using (var decryptionContentStream = decryptedContent.ToStream())
                {
                    var xDoc = XDocument.Load(decryptionContentStream);
                    return(xDoc);
                }
            }
            catch (System.Xml.XmlException)
            {
                return(null);
            }
        }
Esempio n. 5
0
 protected abstract T DoReadContent(string path, IDecryptionAlgorithm decryptionAlgorithm);