Table of Contents

Class PiiEncryptionSettings

Namespace
SEBT.Portal.Core.AppSettings
Assembly
SEBT.Portal.Core.dll

AES-256-GCM key material configuration for reversible PII column encryption (see ADR).

public class PiiEncryptionSettings : IHaveConfigSectionName
Inheritance
object
PiiEncryptionSettings
Implements

Fields

RequiredKeyMaterialLengthBytes

Decoded key material must be exactly this many bytes (256-bit AES only).

public const int RequiredKeyMaterialLengthBytes = 32

Field Value

int

Properties

ActiveKeyId

The key id entries are encrypted or re-encrypted with at write time. Required when EncryptAtRest is true.

public string ActiveKeyId { get; set; }

Property Value

string

EncryptAtRest

When true, new and updated PII columns are stored as AES-GCM envelopes. When false, writes persist trimmed plaintext (reads still decrypt existing envelopes). Opt in per state/deployment; when true in production, keys are validated.

public bool EncryptAtRest { get; set; }

Property Value

bool

Keys

Historical + active symmetric keys keyed by logical id. Required when EncryptAtRest is true.

public List<PiiEncryptionKeySetting> Keys { get; set; }

Property Value

List<PiiEncryptionKeySetting>

RunStartupBackfill

When true, SEBT.Portal.Infrastructure.Services.PiiPlaintextEncryptionBackfill runs after EF migrations on startup. Named rather than cref'd: Core does not reference Infrastructure, so the type is not resolvable here.

public bool RunStartupBackfill { get; set; }

Property Value

bool

SectionName

public static string SectionName { get; }

Property Value

string

Methods

HasKeyRingConfiguration()

True when ActiveKeyId and at least one non-empty key entry are bound (coherence validated separately when encryption is on).

public bool HasKeyRingConfiguration()

Returns

bool

ResolveKeyRing()

public IReadOnlyDictionary<string, byte[]> ResolveKeyRing()

Returns

IReadOnlyDictionary<string, byte[]>