Add BLOB at-rest encryption support#25836
Draft
ugurozturk wants to merge 2 commits into
Draft
Conversation
…decryption - Introduced IByteArrayEncryptionService interface for encrypting and decrypting binary data with authenticated encryption. - Implemented methods for encrypting and decrypting byte arrays and streams, including options for passphrase and salt. - Enhanced blob storing tests to cover encryption scenarios, including tenant-specific passphrases and custom pipeline contributors. - Added FakeInMemoryBlobProvider and various test containers to facilitate testing of blob storage with encryption. - Created unit tests for ByteArrayEncryptionService to validate encryption and decryption functionality, including edge cases for tampered data and oversized chunks.
maliming
self-requested a review
July 20, 2026 01:43
maliming
marked this pull request as draft
July 22, 2026 08:12
maliming
marked this pull request as draft
July 22, 2026 08:12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolve #25835
Description
This PR adds transparent at-rest encryption to the BLOB Storing system. The BLOB stream is encrypted before it reaches the configured storage provider and decrypted while it is read back, so the existing provider packages do not require any changes.
Encryption
AbpBlobStoringEncryptionOptions.KdfIterations, allowed range 100,000 - 600,000).ABPEmagic and a format version; a golden-vector test freezes the v1 format on disk.Configuration and key resolution
UseEncryption()enables encryption for a single container or for the default container configuration;DisableEncryption()opts a container out again.AbpBlobStoringEncryptionOptions.DefaultPassPhrase. There is no built-in default value: if no passphrase can be resolved, saving and reading fail with a descriptive exception.IBlobEncryptionKeyProvidercan be replaced to read passphrases from a vault or another secret store, or to supply tenant-specific keys (BlobEncryptionKeySource.Tenant).UseEncryption(allowLegacyPlaintext: true)) intended for migrating containers that already have data; by default, content without the encrypted format fails to be read.Provider compatibility
Usage
Encrypt the BLOBs of a specific container:
Encrypt all containers by default, with a single container opting out:
Compatibility and operational notes
IsMultiTenantvalue, moving BLOBs between tenants or containers, or switching to a provider that normalizes names differently requires re-saving (decrypting) the BLOBs first.Documentation
Adds a dedicated BLOB Encryption document covering enabling, key resolution, custom and tenant-specific key providers, migrating existing containers, changing a passphrase, behavioral changes for encrypted containers, performance cost, the encryption format and troubleshooting.
How to test it?
Volo.Abp.BlobStoring.Tests(57 tests): round trips, empty and multi-chunk content, tampering, truncation, wrong keys, identity binding, key-source routing, legacy plaintext handling, cancellation, disposal and the format golden vector.Volo.Abp.BlobStoring.FileSystem.Tests(42 tests): the same scenarios against the real file system, tenant file layout and the save retry behavior.