Class EncryptDataAttribute
- Namespace
- Stratara.Abstractions.Security
- Assembly
- Stratara.Abstractions.dll
Marks a property, class, or parameter for transparent encryption by ISecureJsonSerializer. The serializer pulls the matching DEK from IKeyStore using the supplied Level + ambient Subject identifiers.
[ExcludeFromCodeCoverage]
[AttributeUsage(AttributeTargets.Class|AttributeTargets.Property|AttributeTargets.Parameter)]
public sealed class EncryptDataAttribute : Attribute
- Inheritance
-
EncryptDataAttribute
- Inherited Members
- Extension Methods
Examples
Per-property encryption: only Pan is wrapped in the ciphertext envelope at rest and on the
command bus; other fields stay plaintext.
public sealed record AddPaymentCard(
Guid CustomerId,
[EncryptData(DataSensitivityLevel.UserScoped)] string Pan,
int ExpiryMonth,
int ExpiryYear) : ICommand;
Constructors
EncryptDataAttribute(DataSensitivityLevel)
Marks a property, class, or parameter for transparent encryption by ISecureJsonSerializer. The serializer pulls the matching DEK from IKeyStore using the supplied Level + ambient Subject identifiers.
public EncryptDataAttribute(DataSensitivityLevel level = DataSensitivityLevel.UserScoped)
Parameters
levelDataSensitivityLevelThe sensitivity tier — defaults to UserScoped.
Examples
Per-property encryption: only Pan is wrapped in the ciphertext envelope at rest and on the
command bus; other fields stay plaintext.
public sealed record AddPaymentCard(
Guid CustomerId,
[EncryptData(DataSensitivityLevel.UserScoped)] string Pan,
int ExpiryMonth,
int ExpiryYear) : ICommand;
Properties
Level
The configured sensitivity tier.
public DataSensitivityLevel Level { get; }