Table of Contents

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

policy MigrationPolicy

The migration policy to evaluate.

cancellationToken CancellationToken

A 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

migrationId string

The identifier of the migration to check.

cancellationToken CancellationToken

A 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

encryptedData EncryptedData

The encrypted data to migrate.

sourceContext EncryptionContext

The encryption context used for the original encryption.

targetContext EncryptionContext

The encryption context to use for re-encryption.

cancellationToken CancellationToken

A 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

items IReadOnlyList<EncryptionMigrationItem>

The encrypted data items to migrate with their source contexts.

targetContext EncryptionContext

The encryption context to use for re-encryption.

options BatchMigrationOptions

Options controlling batch migration behavior.

cancellationToken CancellationToken

A 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

encryptedData EncryptedData

The encrypted data to check.

policy MigrationPolicy

The migration policy to evaluate against.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task<bool>

True if the data requires migration; otherwise, false.