1 interface inheriting from IAuthenticatedEncryptor
Microsoft.AspNetCore.DataProtection (1)
AuthenticatedEncryption\IOptimizedAuthenticatedEncryptor.cs (1)
11
internal interface IOptimizedAuthenticatedEncryptor :
IAuthenticatedEncryptor
2 implementations of IAuthenticatedEncryptor
KeyManagementSimulator (1)
Program.cs (1)
280
sealed class MockAuthenticatedEncryptor :
IAuthenticatedEncryptor
Microsoft.AspNetCore.DataProtection (1)
Managed\ManagedAuthenticatedEncryptor.cs (1)
16
internal sealed unsafe class ManagedAuthenticatedEncryptor :
IAuthenticatedEncryptor
, IDisposable
101 references to IAuthenticatedEncryptor
KeyManagementSimulator (3)
Program.cs (3)
282
byte[]
IAuthenticatedEncryptor
.Decrypt(ArraySegment<byte> ciphertext, ArraySegment<byte> _additionalAuthenticatedData) => ciphertext.ToArray();
283
byte[]
IAuthenticatedEncryptor
.Encrypt(ArraySegment<byte> plaintext, ArraySegment<byte> _additionalAuthenticatedData) => plaintext.ToArray();
294
IAuthenticatedEncryptor
IAuthenticatedEncryptorFactory.CreateEncryptorInstance(IKey key)
Microsoft.AspNetCore.DataProtection (36)
AuthenticatedEncryption\AuthenticatedEncryptorExtensions.cs (2)
11
public static byte[] Encrypt(this
IAuthenticatedEncryptor
encryptor, ArraySegment<byte> plaintext, ArraySegment<byte> additionalAuthenticatedData, uint preBufferSize, uint postBufferSize)
39
public static void PerformSelfTest(this
IAuthenticatedEncryptor
encryptor)
AuthenticatedEncryption\AuthenticatedEncryptorFactory.cs (3)
19
/// An <see cref="IAuthenticatedEncryptorFactory"/> to create an <see cref="
IAuthenticatedEncryptor
"/>
36
public
IAuthenticatedEncryptor
? CreateEncryptorInstance(IKey key)
47
internal
IAuthenticatedEncryptor
? CreateAuthenticatedEncryptorInstance(
AuthenticatedEncryption\CngCbcAuthenticatedEncryptorFactory.cs (1)
36
public
IAuthenticatedEncryptor
? CreateEncryptorInstance(IKey key)
AuthenticatedEncryption\CngGcmAuthenticatedEncryptorFactory.cs (1)
36
public
IAuthenticatedEncryptor
? CreateEncryptorInstance(IKey key)
AuthenticatedEncryption\ConfigurationModel\AuthenticatedEncryptorConfiguration.cs (1)
48
var
encryptor = factory.CreateAuthenticatedEncryptorInstance(secret, this);
AuthenticatedEncryption\ConfigurationModel\IAuthenticatedEncryptorDescriptor.cs (1)
10
/// material) necessary to create an instance of an <see cref="
IAuthenticatedEncryptor
"/>.
AuthenticatedEncryption\IAuthenticatedEncryptorFactory.cs (6)
10
/// A factory to produce <see cref="
IAuthenticatedEncryptor
"/> instances.
15
/// Creates an <see cref="
IAuthenticatedEncryptor
"/> instance based on the given <see cref="IKey.Descriptor"/>.
17
/// <returns>An <see cref="
IAuthenticatedEncryptor
"/> instance.</returns>
20
/// be considered equivalent, e.g., the payload returned by one's <see cref="
IAuthenticatedEncryptor
.Encrypt(ArraySegment{byte}, ArraySegment{byte})"/>
21
/// method should be consumable by the other's <see cref="
IAuthenticatedEncryptor
.Decrypt(ArraySegment{byte}, ArraySegment{byte})"/> method.
23
IAuthenticatedEncryptor
? CreateEncryptorInstance(IKey key);
AuthenticatedEncryption\ManagedAuthenticatedEncryptorFactory.cs (1)
31
public
IAuthenticatedEncryptor
? CreateEncryptorInstance(IKey key)
EphemeralDataProtectionProvider.cs (3)
83
public
IAuthenticatedEncryptor
? DefaultAuthenticatedEncryptor { get; }
87
public
IAuthenticatedEncryptor
? GetAuthenticatedEncryptorByKeyId(Guid keyId, out bool isRevoked)
98
private static
IAuthenticatedEncryptor
? GetDefaultEncryptor(ILoggerFactory loggerFactory)
KeyManagement\DefaultKeyResolver.cs (1)
100
var
encryptorInstance = key.CreateEncryptor();
KeyManagement\IKey.cs (3)
54
/// Creates an <see cref="
IAuthenticatedEncryptor
"/> instance that can be used to encrypt data
57
/// <returns>An <see cref="
IAuthenticatedEncryptor
"/>.</returns>
58
IAuthenticatedEncryptor
? CreateEncryptor();
KeyManagement\Internal\IKeyRing.cs (2)
20
IAuthenticatedEncryptor
? DefaultAuthenticatedEncryptor { get; }
34
IAuthenticatedEncryptor
? GetAuthenticatedEncryptorByKeyId(Guid keyId, out bool isRevoked);
KeyManagement\Key.cs (3)
29
private
IAuthenticatedEncryptor
? _encryptor;
183
public
IAuthenticatedEncryptor
? CreateEncryptor()
189
var
encryptor = factory.CreateEncryptorInstance(this);
KeyManagement\KeyManagementOptions.cs (1)
163
/// <see cref="
IAuthenticatedEncryptor
"/>s.
KeyManagement\KeyRing.cs (5)
40
public
IAuthenticatedEncryptor
? DefaultAuthenticatedEncryptor
56
public
IAuthenticatedEncryptor
? GetAuthenticatedEncryptorByKeyId(Guid keyId, out bool isRevoked)
67
private
IAuthenticatedEncryptor
? _encryptor;
74
internal
IAuthenticatedEncryptor
? GetEncryptorInstance(out bool isRevoked)
78
IAuthenticatedEncryptor
? encryptor = Volatile.Read(ref _encryptor);
KeyManagement\KeyRingBasedDataProtector.cs (2)
98
var
defaultEncryptorInstance = currentKeyRing.DefaultAuthenticatedEncryptor;
229
var
requestedEncryptor = currentKeyRing.GetAuthenticatedEncryptorByKeyId(keyIdFromPayload, out keyWasRevoked);
Microsoft.AspNetCore.DataProtection.Tests (62)
AuthenticatedEncryption\CngCbcAuthenticatedEncryptorFactoryTest.cs (2)
26
var
encryptor = factory.CreateEncryptorInstance(key.Object);
44
var
encryptor = factory.CreateEncryptorInstance(key.Object);
AuthenticatedEncryption\CngGcmAuthenticatedEncryptorFactoryTest.cs (2)
26
var
encryptor = factory.CreateEncryptorInstance(key.Object);
44
var
encryptor = factory.CreateEncryptorInstance(key.Object);
AuthenticatedEncryption\ConfigurationModel\AuthenticatedEncryptorDescriptorDeserializerTests.cs (3)
25
var
control = CreateEncryptorInstanceFromDescriptor(descriptor);
34
var
test = CreateEncryptorInstanceFromDescriptor(deserializedDescriptor as AuthenticatedEncryptorDescriptor);
44
private static
IAuthenticatedEncryptor
CreateEncryptorInstanceFromDescriptor(AuthenticatedEncryptorDescriptor descriptor)
AuthenticatedEncryption\ConfigurationModel\AuthenticatedEncryptorDescriptorTests.cs (5)
42
var
test = CreateEncryptorInstanceFromDescriptor(CreateDescriptor(encryptionAlgorithm, validationAlgorithm, masterKey));
68
var
test = CreateEncryptorInstanceFromDescriptor(CreateDescriptor(encryptionAlgorithm, ValidationAlgorithm.HMACSHA256 /* unused */, masterKey));
94
var
test = CreateEncryptorInstanceFromDescriptor(CreateDescriptor(encryptionAlgorithm, ValidationAlgorithm.HMACSHA256 /* unused */, masterKey));
132
var
test = CreateEncryptorInstanceFromDescriptor(CreateDescriptor(encryptionAlgorithm, validationAlgorithm, masterKey));
197
private static
IAuthenticatedEncryptor
CreateEncryptorInstanceFromDescriptor(AuthenticatedEncryptorDescriptor descriptor)
AuthenticatedEncryption\ConfigurationModel\CngCbcAuthenticatedEncryptorDescriptorDeserializerTests.cs (3)
32
var
control = CreateEncryptorInstanceFromDescriptor(descriptor);
41
var
test = CreateEncryptorInstanceFromDescriptor(deserializedDescriptor as CngCbcAuthenticatedEncryptorDescriptor);
51
private static
IAuthenticatedEncryptor
CreateEncryptorInstanceFromDescriptor(CngCbcAuthenticatedEncryptorDescriptor descriptor)
AuthenticatedEncryption\ConfigurationModel\CngGcmAuthenticatedEncryptorDescriptorDeserializerTests.cs (3)
30
var
control = CreateEncryptorInstanceFromDescriptor(descriptor);
38
var
test = CreateEncryptorInstanceFromDescriptor(deserializedDescriptor as CngGcmAuthenticatedEncryptorDescriptor);
48
private static
IAuthenticatedEncryptor
CreateEncryptorInstanceFromDescriptor(CngGcmAuthenticatedEncryptorDescriptor descriptor)
AuthenticatedEncryption\ConfigurationModel\ManagedAuthenticatedEncryptorDescriptorDeserializerTests.cs (5)
31
var
control = CreateEncryptorInstanceFromDescriptor(descriptor);
42
var
test = CreateEncryptorInstanceFromDescriptor(deserializedDescriptor as ManagedAuthenticatedEncryptorDescriptor);
65
var
control = CreateEncryptorInstanceFromDescriptor(descriptor);
76
var
test = CreateEncryptorInstanceFromDescriptor(deserializedDescriptor as ManagedAuthenticatedEncryptorDescriptor);
149
private static
IAuthenticatedEncryptor
CreateEncryptorInstanceFromDescriptor(ManagedAuthenticatedEncryptorDescriptor descriptor)
AuthenticatedEncryption\ManagedAuthenticatedEncryptorFactoryTest.cs (2)
24
var
encryptor = factory.CreateEncryptorInstance(key.Object);
41
var
encryptor = factory.CreateEncryptorInstance(key.Object);
KeyManagement\DefaultKeyResolverTests.cs (3)
339
var mockEncryptor = new Mock<
IAuthenticatedEncryptor
>();
409
var mockEncryptor = new Mock<
IAuthenticatedEncryptor
>();
472
mockKey.Setup(o => o.CreateEncryptor()).Returns(Mock.Of<
IAuthenticatedEncryptor
>());
KeyManagement\KeyRingBasedDataProtectorTests.cs (12)
43
var mockEncryptor = new Mock<
IAuthenticatedEncryptor
>();
81
var mockEncryptor = new Mock<
IAuthenticatedEncryptor
>();
204
mockEncryptorFactory.Setup(o => o.CreateEncryptorInstance(It.IsAny<IKey>())).Returns(new Mock<
IAuthenticatedEncryptor
>().Object);
232
mockEncryptorFactory.Setup(m => m.CreateEncryptorInstance(It.IsAny<IKey>())).Returns(new Mock<
IAuthenticatedEncryptor
>().Object);
257
mockEncryptorFactory.Setup(o => o.CreateEncryptorInstance(It.IsAny<IKey>())).Returns(new Mock<
IAuthenticatedEncryptor
>().Object);
288
mockEncryptorFactory.Setup(o => o.CreateEncryptorInstance(It.IsAny<IKey>())).Returns(new Mock<
IAuthenticatedEncryptor
>().Object);
324
mockEncryptorFactory.Setup(o => o.CreateEncryptorInstance(It.IsAny<IKey>())).Returns(new Mock<
IAuthenticatedEncryptor
>().Object);
391
mockEncryptorFactory.Setup(o => o.CreateEncryptorInstance(It.IsAny<IKey>())).Returns(new Mock<
IAuthenticatedEncryptor
>().Object);
421
var mockEncryptor = new Mock<
IAuthenticatedEncryptor
>();
468
var mockEncryptor = new Mock<
IAuthenticatedEncryptor
>();
517
var mockEncryptor = new Mock<
IAuthenticatedEncryptor
>();
592
var mockEncryptor = new Mock<
IAuthenticatedEncryptor
>();
KeyManagement\KeyRingProviderTests.cs (3)
881
mockEncryptorFactory.Setup(m => m.CreateEncryptorInstance(It.IsAny<IKey>())).Returns(new Mock<
IAuthenticatedEncryptor
>().Object);
898
mockEncryptorFactory.Setup(m => m.CreateEncryptorInstance(It.IsAny<IKey>())).Returns(new Mock<
IAuthenticatedEncryptor
>().Object);
944
mockKey.Setup(o => o.CreateEncryptor()).Returns(new Mock<
IAuthenticatedEncryptor
>().Object);
KeyManagement\KeyRingTests.cs (11)
16
var
expectedEncryptorInstance = new Mock<
IAuthenticatedEncryptor
>().Object;
52
var key3 = new MyKey(expectedEncryptorInstance: new Mock<
IAuthenticatedEncryptor
>().Object);
66
var
expectedEncryptorInstance1 = new Mock<
IAuthenticatedEncryptor
>().Object;
67
var
expectedEncryptorInstance2 = new Mock<
IAuthenticatedEncryptor
>().Object;
97
private readonly Func<
IAuthenticatedEncryptor
> _encryptorFactory;
99
public MyKey(bool isRevoked = false,
IAuthenticatedEncryptor
expectedEncryptorInstance = null)
106
_encryptorFactory = () => expectedEncryptorInstance ?? new Mock<
IAuthenticatedEncryptor
>().Object;
116
public
IAuthenticatedEncryptor
CreateEncryptor()
KeyManagement\XmlKeyManagerTests.cs (8)
86
var
expectedAuthenticatedEncryptor = new Mock<
IAuthenticatedEncryptor
>().Object;
175
var
expectedAuthenticatedEncryptor = new Mock<
IAuthenticatedEncryptor
>().Object;
1033
private
IAuthenticatedEncryptor
_expectedEncryptor;
1035
public TestEncryptorFactory(IAuthenticatedEncryptorDescriptor associatedDescriptor = null,
IAuthenticatedEncryptor
expectedEncryptor = null)
1041
public
IAuthenticatedEncryptor
CreateEncryptorInstance(IKey key)
1048
return _expectedEncryptor ?? new Mock<
IAuthenticatedEncryptor
>().Object;