Class KeyRotationPolicy
- Namespace
- Excalibur.Compliance
- Assembly
- Excalibur.Compliance.Abstractions.dll
Defines a rotation policy for encryption keys.
public sealed record KeyRotationPolicy : IEquatable<KeyRotationPolicy>
- Inheritance
-
KeyRotationPolicy
- Implements
- Inherited Members
Remarks
Key rotation policies determine when keys should be rotated. Different key purposes may have different rotation schedules based on compliance requirements and risk assessment.
Properties
Algorithm
Gets the encryption algorithm to use when creating new key versions.
public EncryptionAlgorithm Algorithm { get; set; }
Property Value
Archival
Creates a policy for archival keys with annual rotation.
public static KeyRotationPolicy Archival { get; }
Property Value
AutoRotateEnabled
Gets a value indicating whether automatic rotation is enabled for this policy.
public bool AutoRotateEnabled { get; set; }
Property Value
Default
Creates a default policy with 90-day rotation.
public static KeyRotationPolicy Default { get; }
Property Value
HighSecurity
Creates a strict policy for high-security keys with 30-day rotation.
public static KeyRotationPolicy HighSecurity { get; }
Property Value
MaxKeyAge
Gets the maximum age of a key before rotation is required.
public TimeSpan MaxKeyAge { get; set; }
Property Value
Remarks
Default is 90 days per SOC 2 and PCI DSS recommendations. NIST 800-57 recommends rotation at least annually.
Name
Gets the name of this policy.
[Required]
public string Name { get; set; }
Property Value
NotifyBeforeRotation
Gets a value indicating whether to send notifications before rotation.
public bool NotifyBeforeRotation { get; set; }
Property Value
Purpose
Gets the key purpose this policy applies to. Null applies to all purposes without a specific policy.
public string? Purpose { get; set; }
Property Value
RequireFipsCompliance
Gets a value indicating whether to require FIPS 140-2 compliant key generation.
public bool RequireFipsCompliance { get; set; }
Property Value
RetainedVersionCount
Gets the number of previous key versions to retain for decryption.
public int RetainedVersionCount { get; set; }
Property Value
Remarks
This supports zero-downtime rotation by allowing decryption with previous key versions while new encryptions use the latest version.
WarningDaysBeforeRotation
Gets the number of days before rotation to generate a warning.
public int WarningDaysBeforeRotation { get; set; }
Property Value
Methods
GetNextRotationTime(KeyMetadata)
Gets the next scheduled rotation time for a key.
public DateTimeOffset GetNextRotationTime(KeyMetadata key)
Parameters
keyKeyMetadataThe key metadata.
Returns
- DateTimeOffset
The next rotation time based on this policy.
IsRotationDue(KeyMetadata)
Determines whether the specified key metadata indicates rotation is due.
public bool IsRotationDue(KeyMetadata key)
Parameters
keyKeyMetadataThe key metadata to check.
Returns
- bool
True if the key should be rotated; otherwise false.
ShouldWarn(KeyMetadata)
Determines whether a rotation warning should be generated for the key.
public bool ShouldWarn(KeyMetadata key)
Parameters
keyKeyMetadataThe key metadata to check.
Returns
- bool
True if a warning should be generated; otherwise false.