Interface IEncryptionMigrationService
- Namespace
- Excalibur.Compliance
- Assembly
- Excalibur.Compliance.Abstractions.dll
Provides services for migrating encrypted data between providers, algorithms, or key versions.
public interface IEncryptionMigrationService
Remarks
This interface supports encryption migrations such as: - Re-encrypting data with a new key version after key rotation - Migrating data from one encryption algorithm to another - Transferring encrypted data between encryption providers
Migrations are designed to be resumable and can be performed in batches for large datasets. Progress tracking enables monitoring and recovery from interrupted migrations.
Methods
EstimateMigrationAsync(MigrationPolicy, CancellationToken)
Estimates the scope of a migration for planning purposes.
Task<MigrationEstimate> EstimateMigrationAsync(MigrationPolicy policy, CancellationToken cancellationToken)
Parameters
policyMigrationPolicyThe migration policy to evaluate.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task<MigrationEstimate>
An estimate of the migration scope.
GetMigrationStatusAsync(string, CancellationToken)
Gets the current migration status for tracking purposes.
Task<MigrationStatus?> GetMigrationStatusAsync(string migrationId, CancellationToken cancellationToken)
Parameters
migrationIdstringThe identifier of the migration to check.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task<MigrationStatus>
The current status of the migration, or null if not found.
MigrateAsync(EncryptedData, EncryptionContext, EncryptionContext, CancellationToken)
Re-encrypts a single piece of encrypted data using the target configuration.
Task<EncryptionMigrationResult> MigrateAsync(EncryptedData encryptedData, EncryptionContext sourceContext, EncryptionContext targetContext, CancellationToken cancellationToken)
Parameters
encryptedDataEncryptedDataThe encrypted data to migrate.
sourceContextEncryptionContextThe encryption context used for the original encryption.
targetContextEncryptionContextThe encryption context to use for re-encryption.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task<EncryptionMigrationResult>
The result of the migration operation.
Exceptions
- ArgumentNullException
Thrown when any parameter is null.
- EncryptionMigrationException
Thrown when migration fails.
MigrateBatchAsync(IReadOnlyList<EncryptionMigrationItem>, EncryptionContext, BatchMigrationOptions, CancellationToken)
Re-encrypts a batch of encrypted data items using the target configuration.
Task<EncryptionBatchMigrationResult> MigrateBatchAsync(IReadOnlyList<EncryptionMigrationItem> items, EncryptionContext targetContext, BatchMigrationOptions options, CancellationToken cancellationToken)
Parameters
itemsIReadOnlyList<EncryptionMigrationItem>The encrypted data items to migrate with their source contexts.
targetContextEncryptionContextThe encryption context to use for re-encryption.
optionsBatchMigrationOptionsOptions controlling batch migration behavior.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task<EncryptionBatchMigrationResult>
The results of the batch migration operation.
Exceptions
- ArgumentNullException
Thrown when any parameter is null.
RequiresMigrationAsync(EncryptedData, MigrationPolicy, CancellationToken)
Checks if the encrypted data requires migration based on the current policy.
Task<bool> RequiresMigrationAsync(EncryptedData encryptedData, MigrationPolicy policy, CancellationToken cancellationToken)
Parameters
encryptedDataEncryptedDataThe encrypted data to check.
policyMigrationPolicyThe migration policy to evaluate against.
cancellationTokenCancellationTokenA token to cancel the operation.