.NET API
IContentProtector
Tracon.Abstractions.dllExtension point for at-rest encryption of stored content.
public interface IContentProtectorRemarks
Section titled “Remarks”There is no default implementation; a consumer opts in explicitly through
AddContentProtection. When nothing is registered, the stores that
consume this interface fall back to a no-op implementation that writes
plaintext unchanged — today’s behavior, with no surprises.
This protects data at rest, not a running process. A process holding the key still sees plaintext once a value is read back; this interface addresses a stolen backup, a discarded disk, or a misconfigured table permission — not a compromised application server.
IContentProtector.Unprotect and IContentProtector.UnprotectBytes are self-describing: they decide whether a value is protected by looking at the value itself, not at configuration. A value written before protection was turned on therefore stays readable after protection is turned on, and a value written while protection was on stays readable after it is turned off.
Properties
Section titled “Properties”IsEnabled
Section titled “ IsEnabled”Gets a value indicating whether this instance is ready to protect new writes.
bool IsEnabled { get; }Property Value
Section titled “Property Value”Remarks
Section titled “Remarks”A column-level decision (which columns are in scope) is layered on top of this by the caller; this flag only says whether the implementation itself has everything it needs (for example, a resolved encryption key).
Methods
Section titled “Methods”Protect(string)
Section titled “ Protect(string)”Protects a text value before it is written to storage.
string Protect(string plaintext)Parameters
Section titled “Parameters”plaintext string
The value to protect.
Returns
Section titled “Returns”The protected representation. It must be safe to store in the same column the plaintext would have gone into.
ProtectBytes(ReadOnlySpan<byte>)
Section titled “ ProtectBytes(ReadOnlySpan<byte>)”Protects binary data before it is written to storage.
byte[] ProtectBytes(ReadOnlySpan<byte> plaintext)Parameters
Section titled “Parameters”plaintext ReadOnlySpan<byte>
The bytes to protect.
Returns
Section titled “Returns”byte[]
The protected representation. It must be safe to store in the same column the plaintext would have gone into.
Unprotect(string)
Section titled “ Unprotect(string)”Reverses IContentProtector.Protect.
string Unprotect(string stored)Parameters
Section titled “Parameters”stored string
The value as read back from storage.
Returns
Section titled “Returns”The original plaintext. When stored was never
protected, it is returned unchanged.
UnprotectBytes(ReadOnlySpan<byte>)
Section titled “ UnprotectBytes(ReadOnlySpan<byte>)”Reverses IContentProtector.ProtectBytes.
byte[] UnprotectBytes(ReadOnlySpan<byte> stored)Parameters
Section titled “Parameters”stored ReadOnlySpan<byte>
The bytes as read back from storage.
Returns
Section titled “Returns”byte[]
The original bytes. When stored was never
protected, it is returned unchanged.