2 implementations of KeyId
Microsoft.AspNetCore.DataProtection (1)
KeyManagement\Key.cs (1)
124
public Guid
KeyId
{ get; }
Microsoft.AspNetCore.DataProtection.Tests (1)
KeyManagement\KeyRingTests.cs (1)
113
public Guid
KeyId
{ get; }
61 references to KeyId
KeyManagementSample (2)
Program.cs (2)
41
Console.WriteLine($"Key {key.
KeyId
:B}: Created = {key.CreationDate:u}, IsRevoked = {key.IsRevoked}");
59
Console.WriteLine($"Key {key.
KeyId
:B}: Created = {key.CreationDate:u}, IsRevoked = {key.IsRevoked}");
Microsoft.AspNetCore.DataProtection (15)
KeyManagement\DefaultKeyResolver.cs (6)
106
key.
KeyId
,
133
_logger.KeyIsIneligibleToBeTheDefaultKeyBecauseItsMethodFailed(key.
KeyId
, nameof(IKey.CreateEncryptor), exceptions is null ? ex : new AggregateException(exceptions));
137
_logger.RetryingMethodOfKeyAfterFailure(key.
KeyId
, nameof(IKey.CreateEncryptor), ex);
162
orderby key.ActivationDate descending, key.
KeyId
ascending
169
_logger.ConsideringKeyWithExpirationDateAsDefaultKey(preferredDefaultKey.
KeyId
, preferredDefaultKey.ExpirationDate);
174
_logger.KeyIsNoLongerUnderConsiderationAsDefault(preferredDefaultKey.
KeyId
);
KeyManagement\KeyRing.cs (4)
25
_keyIdToKeyHolderMap.Add(key.
KeyId
, new KeyHolder(key));
31
if (!_keyIdToKeyHolderMap.ContainsKey(defaultKey.
KeyId
))
33
_keyIdToKeyHolderMap.Add(defaultKey.
KeyId
, new KeyHolder(defaultKey));
36
DefaultKeyId = defaultKey.
KeyId
;
KeyManagement\KeyRingProvider.cs (4)
146
_logger.UsingFallbackKeyWithExpirationAsDefaultKey(keyToUse.
KeyId
, keyToUse.ExpirationDate);
181
_logger.KeyRingDefaultKeyIsRevoked(defaultKey.
KeyId
);
182
throw Error.KeyRingProvider_DefaultKeyRevoked(defaultKey.
KeyId
);
185
_logger.UsingKeyAsDefaultKey(defaultKey.
KeyId
);
KeyManagement\XmlKeyManager.cs (1)
445
var keyId = key.
KeyId
;
Microsoft.AspNetCore.DataProtection.Tests (44)
KeyManagement\DefaultKeyResolverTests.cs (1)
461
mockKey.Setup(o => o.
KeyId
).Returns(Guid.NewGuid());
KeyManagement\KeyRingProviderTests.cs (10)
47
Assert.Equal(key1.
KeyId
, cacheableKeyRing.KeyRing.DefaultKeyId);
90
Assert.Equal(key1.
KeyId
, cacheableKeyRing.KeyRing.DefaultKeyId);
138
Assert.Equal(key1.
KeyId
, cacheableKeyRing.KeyRing.DefaultKeyId);
227
Assert.Equal(newlyCreatedKey.
KeyId
, cacheableKeyRing.KeyRing.DefaultKeyId);
311
Assert.Equal(key2.
KeyId
, cacheableKeyRing.KeyRing.DefaultKeyId);
351
Assert.Equal(key1.
KeyId
, cacheableKeyRing.KeyRing.DefaultKeyId);
389
Assert.Equal(key1.
KeyId
, cacheableKeyRing.KeyRing.DefaultKeyId);
512
Assert.Equal(key1.
KeyId
, cacheableKeyRing.KeyRing.DefaultKeyId);
558
Assert.Equal(key.
KeyId
, cacheableKeyRing.KeyRing.DefaultKeyId);
939
mockKey.Setup(o => o.
KeyId
).Returns(Guid.NewGuid());
KeyManagement\XmlKeyManagerTests.cs (33)
129
Assert.Equal(keyId, newKey.
KeyId
);
227
Assert.Equal(keyId, newKey.
KeyId
);
372
Assert.Equal(new Guid("62a72ad9-42d7-4e97-b3fa-05bad5d53d33"), keys[0].
KeyId
);
378
Assert.Equal(new Guid("041be4c0-52d7-48b4-8d32-f8c0ff315459"), keys[1].
KeyId
);
449
Assert.Equal(new Guid("67f9cdea-83ba-41ed-b160-2b1d0ea30251"), keys[0].
KeyId
);
451
Assert.Equal(new Guid("0cf83742-d175-42a8-94b5-1ec049b354c3"), keys[1].
KeyId
);
453
Assert.Equal(new Guid("21580ac4-c83a-493c-bde6-29a1cc97ca0f"), keys[2].
KeyId
);
455
Assert.Equal(new Guid("6bd14f12-0bb8-4822-91d7-04b360de0497"), keys[3].
KeyId
);
487
Assert.Equal(new Guid("09712588-ba68-438a-a5ee-fe842b3453b2"), keys[0].
KeyId
);
526
Assert.Equal(new Guid("49c0cda9-0232-4d8c-a541-de20cc5a73d6"), keys[0].
KeyId
);
823
Assert.Equal(createdKey.
KeyId
, fetchedKey.
KeyId
); // But it should be equivalent
837
Assert.Equal(createdKey.
KeyId
, fetchedKey2.
KeyId
); // But it should be equivalent
924
Assert.Equal(fetchedKey.
KeyId
, fetchedKey2.
KeyId
); // But it should be equivalent
955
keyManager.RevokeKey(key2.
KeyId
); // Revoked by time, but also individually
956
keyManager.RevokeKey(key3.
KeyId
);
957
keyManager.RevokeKey(key3.
KeyId
); // Nothing prevents us from revoking the same key twice
963
var keyDictWithRevocations = keyManager.GetAllKeys().ToDictionary(k => k.
KeyId
);
965
Assert.True(keyDictWithRevocations[key1.
KeyId
].IsRevoked);
966
Assert.True(keyDictWithRevocations[key2.
KeyId
].IsRevoked);
967
Assert.True(keyDictWithRevocations[key3.
KeyId
].IsRevoked);
968
Assert.False(keyDictWithRevocations[key4.
KeyId
].IsRevoked);
970
Assert.True(keyManager.DeleteKeys(key => key.
KeyId
== key1.
KeyId
|| key.
KeyId
== key3.
KeyId
));
974
var keyDictWithDeletions = keyManager.GetAllKeys().ToDictionary(k => k.
KeyId
);
976
Assert.DoesNotContain(key1.
KeyId
, keyDictWithDeletions.Keys);
977
Assert.True(keyDictWithRevocations[key2.
KeyId
].IsRevoked);
978
Assert.DoesNotContain(key3.
KeyId
, keyDictWithDeletions.Keys);
979
Assert.False(keyDictWithRevocations[key4.
KeyId
].IsRevoked);