Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Filo/Core/FiloReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ public async IAsyncEnumerable<byte[]> StreamFileAsync(string fileName, byte[]? k
if (!_fileMap.TryGetValue(fileName, out var entry))
throw new FileNotFoundException($"File '{fileName}' not found in container.");

if (Header.Encryption == "AES256" && key == null)
throw new InvalidOperationException("This container is encrypted. Provide a key.");
if (Header.Encryption == "AES256" && Header.EncryptionMode != "AES-CBC")
throw new InvalidDataException("Unsupported encryption mode.");

if (entry.Chunks.Count == 0)
yield break;
Expand Down
1 change: 1 addition & 0 deletions src/Filo/Core/FiloWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ public async Task WriteAsync()
FileCount = _files.Count,
Compression = "none",
Encryption = _encrypt ? "AES256" : "none",
EncryptionMode = _encrypt ? "AES-CBC" : null,
Kdf = !string.IsNullOrWhiteSpace(_password) ? "PBKDF2" : null,
Salt = !string.IsNullOrWhiteSpace(_password) ? Convert.ToBase64String(_salt!) : null,
PasswordCheck = _encrypt ? SHA256.HashData(_key!) : null,
Expand Down
2 changes: 2 additions & 0 deletions src/Filo/Models/FiloHeader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ public class FiloHeader

public string Encryption { get; set; } = "none";

public string? EncryptionMode { get; set; } = "AES-CBC";

public string? Kdf { get; set; } // v1.1

public string? Salt { get; set; } // v1.1
Expand Down
Loading