Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Storage] Buffer reads of blobs encrypted on client side. #21652

Merged
merged 2 commits into from
Jun 7, 2021
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
1 change: 1 addition & 0 deletions sdk/storage/Azure.Storage.Blobs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Fixed bug where specifying "*" as IfMatch condition could lead to inconsistend read in BlobClient.DownloadTo.
- Fixed bug where specifying conditions in BlobBaseClient.OpenRead could override allowModifications flag in BlobOpenReadOptions leading to inconsistent read.
- Fixed bug where BlobProperties.IsLatestVersion from BlobBaseClient.GetProperties did not set the value (defaulted to false).
- Fixed bug where reading blob with Client Side Encryption enabled results in high CPU.

## 12.8.4 (2021-05-20)
- Fixed bug where Client Side Encryption during large transactions (greater than max int value) would throw an exception.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,11 @@ private static Stream WrapStream(
aesProvider.Padding = PaddingMode.None;
}

return new CryptoStream(contentStream, aesProvider.CreateDecryptor(), CryptoStreamMode.Read);
// Buffer network stream. CryptoStream issues tiny (~16 byte) reads which can lead to resources churn.
// By default buffer is 4KB.
var bufferedContentStream = new BufferedStream(contentStream);

return new CryptoStream(bufferedContentStream, aesProvider.CreateDecryptor(), CryptoStreamMode.Read);
}
}

Expand Down