Interface IEncryptionDecryptionService
- Namespace
- Excalibur.Compliance
- Assembly
- Excalibur.Compliance.Abstractions.dll
Provides bulk decryption services for compliance scenarios (GDPR, audit, data export).
public interface IEncryptionDecryptionService
Remarks
This interface supports streaming decryption for memory efficiency when processing large datasets for compliance requirements.
Use cases include:
- GDPR data portability requests
- Audit trail exports
- Data migration to external systems
- Backup verification
Methods
DecryptAllAsync<T>(IAsyncEnumerable<T>, DecryptionOptions, CancellationToken)
Decrypts all encrypted fields in a collection using streaming for memory efficiency.
IAsyncEnumerable<T> DecryptAllAsync<T>(IAsyncEnumerable<T> source, DecryptionOptions options, CancellationToken cancellationToken) where T : class
Parameters
sourceIAsyncEnumerable<T>The source collection of entities to decrypt.
optionsDecryptionOptionsOptions controlling decryption behavior.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- IAsyncEnumerable<T>
An async enumerable of decrypted entities.
Type Parameters
TThe entity type containing encrypted fields.
Remarks
Entities are processed in batches (per BatchSize) and yielded as they are decrypted to minimize memory usage.
Fields marked with EncryptedFieldAttribute are decrypted; other fields are passed through unchanged.
DecryptEntityAsync<T>(T, DecryptionOptions, CancellationToken)
Decrypts encrypted fields in a single entity.
Task<T> DecryptEntityAsync<T>(T entity, DecryptionOptions options, CancellationToken cancellationToken) where T : class
Parameters
entityTThe entity to decrypt.
optionsDecryptionOptionsOptions controlling decryption behavior.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task<T>
The decrypted entity (same instance with fields decrypted).
Type Parameters
TThe entity type containing encrypted fields.
Remarks
Fields marked with EncryptedFieldAttribute are decrypted in place.
ExportDecryptedAsync<T>(IAsyncEnumerable<T>, BulkDecryptionExportOptions, CancellationToken)
Exports decrypted data to a stream for compliance purposes.
[RequiresUnreferencedCode("Exporting decrypted data uses JSON serialization for generic types which requires preserved members.")]
[RequiresDynamicCode("Exporting decrypted data uses JSON serialization for generic types which requires dynamic code generation.")]
Task ExportDecryptedAsync<T>(IAsyncEnumerable<T> source, BulkDecryptionExportOptions options, CancellationToken cancellationToken) where T : class
Parameters
sourceIAsyncEnumerable<T>The source collection of entities to decrypt and export.
optionsBulkDecryptionExportOptionsOptions controlling export behavior.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task
A task representing the export operation.
Type Parameters
TThe entity type to export.
Remarks
Supports multiple export formats (JSON, CSV, Plaintext) for compliance flexibility.
Data is streamed to the destination to support large exports without loading the entire dataset into memory.