/// <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); }
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); } } }