We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 919618d commit 67d74e2Copy full SHA for 67d74e2
src/DataProtection/DataProtection/src/KeyManagement/XmlKeyManager.cs
@@ -135,9 +135,12 @@ internal XmlKeyManager(
135
/// <inheritdoc />
136
public IKey CreateNewKey(DateTimeOffset activationDate, DateTimeOffset expirationDate)
137
{
138
+ // For an immediately-activated key, the caller's Now may be slightly before ours,
139
+ // so we'll compensate to ensure that activation is never before creation.
140
+ var now = DateTimeOffset.UtcNow;
141
return _internalKeyManager.CreateNewKey(
142
keyId: Guid.NewGuid(),
- creationDate: DateTimeOffset.UtcNow,
143
+ creationDate: activationDate < now ? activationDate : now,
144
activationDate: activationDate,
145
expirationDate: expirationDate);
146
}
0 commit comments