コード例 #1
0
        /// <summary>
        /// Decrypts the zip archive.
        /// </summary>
        /// <returns>The zip archive.</returns>
        /// <param name="paths">Decrypted paths.</param>
        public ZipArchiveEntryItem DecryptZipArchive(ZipArchiveEntryItem paths)
        {
            if (paths == null)
            {
                throw new Exception("Paths must not be null!");
            }

            EnsureFieldsDecrypted(paths, AesEncryptionHelper);

            return(paths);
        }
コード例 #2
0
        private void EnsureFieldsDecrypted(ZipArchiveEntryItem paths, IAesEncryptionHelper aesEncryptionHelper)
        {
            paths.Name = aesEncryptionHelper.Decrypt(paths.Name);

            if (paths.Files != null && paths.Files.Any())
            {
                for (int i = 0; i < paths.Files.Count(); i++)
                {
                    paths.Files[i] = aesEncryptionHelper.Decrypt(paths.Files[i]);
                }
            }

            if (paths.Folders != null && paths.Folders.Any())
            {
                foreach (var folder in paths.Folders)
                {
                    EnsureFieldsDecrypted(folder, aesEncryptionHelper);
                }
            }
        }