Skip to content

Commit

Permalink
Fixed log file being created incorrectly when using encryption
Browse files Browse the repository at this point in the history
  • Loading branch information
lbnascimento committed Aug 21, 2020
1 parent 086a6e0 commit b791f53
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions LiteDB/Engine/Disk/Streams/AesStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ public AesStream(string password, Stream stream)
checkBuffer.Fill(1, 0, checkBuffer.Length);

_writer.Write(checkBuffer, 0, checkBuffer.Length);

//ensure that the "hidden" page in encrypted files is created correctly
_stream.Position = PAGE_SIZE - 1;
_stream.WriteByte(0);
}
else
{
Expand All @@ -115,6 +119,7 @@ public AesStream(string password, Stream stream)
}

_stream.Position = PAGE_SIZE;
_stream.FlushToDisk();

}
catch
Expand Down

1 comment on commit b791f53

@lbnascimento
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably fixes #1762 and #1795

Please # to comment.