Table of Contents

Interface IMigrationService

Namespace
Excalibur.Compliance
Assembly
Excalibur.Compliance.Abstractions.dll

Defines the contract for encryption version migration services.

public interface IMigrationService

Remarks

This service handles the migration of encrypted data between encryption versions. It supports both lazy re-encryption (on-access) and batch migration strategies.

Version detection is performed automatically when reading encrypted data, and re-encryption happens transparently if the data version is older than the current target version.

The IMigrationInfo interface provides access to the current encryption version information without coupling to migration operations.

Methods

DetectVersion(ReadOnlySpan<byte>)

Detects the encryption version of the provided ciphertext.

EncryptionVersion DetectVersion(ReadOnlySpan<byte> ciphertext)

Parameters

ciphertext ReadOnlySpan<byte>

The encrypted data to analyze.

Returns

EncryptionVersion

The detected encryption version.

GetProgress()

Gets the current migration progress statistics.

VersionMigrationProgress GetProgress()

Returns

VersionMigrationProgress

The migration progress information.

MigrateAsync(byte[], CancellationToken)

Migrates encrypted data from an older version to the current version.

Task<VersionMigrationResult> MigrateAsync(byte[] ciphertext, CancellationToken cancellationToken)

Parameters

ciphertext byte[]

The encrypted data to migrate.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task<VersionMigrationResult>

The migration result containing the new ciphertext.

MigrateBatchAsync(IEnumerable<MigrationItem>, CancellationToken)

Performs batch migration of multiple encrypted items.

Task<VersionBatchMigrationResult> MigrateBatchAsync(IEnumerable<MigrationItem> items, CancellationToken cancellationToken)

Parameters

items IEnumerable<MigrationItem>

The items to migrate.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task<VersionBatchMigrationResult>

The batch migration result.

RequiresMigration(ReadOnlySpan<byte>)

Determines if the ciphertext requires migration to a newer version.

bool RequiresMigration(ReadOnlySpan<byte> ciphertext)

Parameters

ciphertext ReadOnlySpan<byte>

The encrypted data to check.

Returns

bool

True if migration is required; otherwise, false.