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