Struct SubjectKey
- Namespace
- Excalibur.Compliance
- Assembly
- Excalibur.Compliance.Abstractions.dll
The key a data subject's values are protected under: the handle that names it, and the identifier of the generation of material currently provisioned there.
public readonly record struct SubjectKey : IEquatable<SubjectKey>
- Implements
- Inherited Members
Remarks
Both halves travel together because they are only meaningful together, and reading them separately reintroduces the defect this type exists to close. A handle is derived from the data subject, so it is stable and therefore re-occupiable — destroy the key and the next ordinary write provisions new material at the same handle. A writer that obtained the handle and then looked up the generation in a second call could be overtaken between the two and bind a generation that no longer matches the material it is about to encrypt under.
So the resolution that provisions the key is the one that reports its generation, in the same operation.
Constructors
SubjectKey(string, KeyGeneration?)
The key a data subject's values are protected under: the handle that names it, and the identifier of the generation of material currently provisioned there.
public SubjectKey(string KeyId, KeyGeneration? Generation)
Parameters
KeyIdstringThe key handle. Derived from the data subject, so it is stable across generations and is what an erasure destroys.
GenerationKeyGeneration?The identifier of the material currently at
KeyId, or null when the configured provider cannot identify one. A null here means a crypto-shred read cannot distinguish a destroyed key from a re-provisioned one, so callers that need that distinction refuse rather than assume.
Remarks
Both halves travel together because they are only meaningful together, and reading them separately reintroduces the defect this type exists to close. A handle is derived from the data subject, so it is stable and therefore re-occupiable — destroy the key and the next ordinary write provisions new material at the same handle. A writer that obtained the handle and then looked up the generation in a second call could be overtaken between the two and bind a generation that no longer matches the material it is about to encrypt under.
So the resolution that provisions the key is the one that reports its generation, in the same operation.
Properties
Generation
The identifier of the material currently at KeyId, or null when the
configured provider cannot identify one. A null here means a crypto-shred read cannot distinguish a
destroyed key from a re-provisioned one, so callers that need that distinction refuse rather than assume.
public KeyGeneration? Generation { get; init; }
Property Value
KeyId
The key handle. Derived from the data subject, so it is stable across generations and is what an erasure destroys.
public string KeyId { get; init; }