61 references to EncryptionAlgorithm
Microsoft.AspNetCore.DataProtection (34)
AuthenticatedEncryption\AuthenticatedEncryptorFactory.cs (24)
108
internal static bool IsGcmAlgorithm(
EncryptionAlgorithm
algorithm)
110
return (
EncryptionAlgorithm
.AES_128_GCM <= algorithm && algorithm <=
EncryptionAlgorithm
.AES_256_GCM);
113
private static int GetAlgorithmKeySizeInBits(
EncryptionAlgorithm
algorithm)
117
case
EncryptionAlgorithm
.AES_128_CBC:
118
case
EncryptionAlgorithm
.AES_128_GCM:
121
case
EncryptionAlgorithm
.AES_192_CBC:
122
case
EncryptionAlgorithm
.AES_192_GCM:
125
case
EncryptionAlgorithm
.AES_256_CBC:
126
case
EncryptionAlgorithm
.AES_256_GCM:
134
private static string GetBCryptAlgorithmNameFromEncryptionAlgorithm(
EncryptionAlgorithm
algorithm)
138
case
EncryptionAlgorithm
.AES_128_CBC:
139
case
EncryptionAlgorithm
.AES_192_CBC:
140
case
EncryptionAlgorithm
.AES_256_CBC:
141
case
EncryptionAlgorithm
.AES_128_GCM:
142
case
EncryptionAlgorithm
.AES_192_GCM:
143
case
EncryptionAlgorithm
.AES_256_GCM:
167
private static Type GetManagedTypeFromEncryptionAlgorithm(
EncryptionAlgorithm
algorithm)
171
case
EncryptionAlgorithm
.AES_128_CBC:
172
case
EncryptionAlgorithm
.AES_192_CBC:
173
case
EncryptionAlgorithm
.AES_256_CBC:
174
case
EncryptionAlgorithm
.AES_128_GCM:
175
case
EncryptionAlgorithm
.AES_192_GCM:
176
case
EncryptionAlgorithm
.AES_256_GCM:
AuthenticatedEncryption\CngCbcAuthenticatedEncryptorFactory.cs (1)
106
throw Error.Common_PropertyCannotBeNullOrEmpty(nameof(
EncryptionAlgorithm
));
AuthenticatedEncryption\CngGcmAuthenticatedEncryptorFactory.cs (1)
73
throw Error.Common_PropertyCannotBeNullOrEmpty(nameof(
EncryptionAlgorithm
));
AuthenticatedEncryption\ConfigurationModel\AuthenticatedEncryptorConfiguration.cs (3)
18
/// The default value is <see cref="
EncryptionAlgorithm
.AES_256_CBC"/>.
20
public
EncryptionAlgorithm
EncryptionAlgorithm { get; set; } =
EncryptionAlgorithm
.AES_256_CBC;
AuthenticatedEncryption\ConfigurationModel\AuthenticatedEncryptorDescriptorDeserializer.cs (2)
34
configuration.EncryptionAlgorithm = (
EncryptionAlgorithm
)Enum.Parse(typeof(
EncryptionAlgorithm
), (string)encryptionElement.Attribute("algorithm")!);
DataProtectionBuilderExtensions.cs (3)
436
/// algorithms specified in the <see cref="
EncryptionAlgorithm
"/> and
458
/// algorithms specified in the <see cref="
EncryptionAlgorithm
"/> and
480
/// algorithms specified in the <see cref="
EncryptionAlgorithm
"/> and
Microsoft.AspNetCore.DataProtection.Tests (27)
AuthenticatedEncryption\ConfigurationModel\AuthenticatedEncryptorDescriptorDeserializerTests.cs (1)
21
EncryptionAlgorithm =
EncryptionAlgorithm
.AES_192_CBC,
AuthenticatedEncryption\ConfigurationModel\AuthenticatedEncryptorDescriptorTests.cs (26)
23
[InlineData(
EncryptionAlgorithm
.AES_128_CBC, ValidationAlgorithm.HMACSHA256)]
24
[InlineData(
EncryptionAlgorithm
.AES_192_CBC, ValidationAlgorithm.HMACSHA256)]
25
[InlineData(
EncryptionAlgorithm
.AES_256_CBC, ValidationAlgorithm.HMACSHA256)]
26
[InlineData(
EncryptionAlgorithm
.AES_128_CBC, ValidationAlgorithm.HMACSHA512)]
27
[InlineData(
EncryptionAlgorithm
.AES_192_CBC, ValidationAlgorithm.HMACSHA512)]
28
[InlineData(
EncryptionAlgorithm
.AES_256_CBC, ValidationAlgorithm.HMACSHA512)]
29
public void CreateAuthenticatedEncryptor_RoundTripsData_CngCbcImplementation(
EncryptionAlgorithm
encryptionAlgorithm, ValidationAlgorithm validationAlgorithm)
54
[InlineData(
EncryptionAlgorithm
.AES_128_GCM)]
55
[InlineData(
EncryptionAlgorithm
.AES_192_GCM)]
56
[InlineData(
EncryptionAlgorithm
.AES_256_GCM)]
57
public void CreateAuthenticatedEncryptor_RoundTripsData_CngGcmImplementation(
EncryptionAlgorithm
encryptionAlgorithm)
80
[InlineData(
EncryptionAlgorithm
.AES_128_GCM)]
81
[InlineData(
EncryptionAlgorithm
.AES_192_GCM)]
82
[InlineData(
EncryptionAlgorithm
.AES_256_GCM)]
83
public void CreateAuthenticatedEncryptor_RoundTripsData_AesGcmImplementation(
EncryptionAlgorithm
encryptionAlgorithm)
104
public static TheoryData<
EncryptionAlgorithm
, ValidationAlgorithm, Func<HMAC>> CreateAuthenticatedEncryptor_RoundTripsData_ManagedImplementationData
107
{
EncryptionAlgorithm
.AES_128_CBC, ValidationAlgorithm.HMACSHA256, () => new HMACSHA256() },
108
{
EncryptionAlgorithm
.AES_192_CBC, ValidationAlgorithm.HMACSHA256, () => new HMACSHA256() },
109
{
EncryptionAlgorithm
.AES_256_CBC, ValidationAlgorithm.HMACSHA256, () => new HMACSHA256() },
110
{
EncryptionAlgorithm
.AES_128_CBC, ValidationAlgorithm.HMACSHA512, () => new HMACSHA512() },
111
{
EncryptionAlgorithm
.AES_192_CBC, ValidationAlgorithm.HMACSHA512, () => new HMACSHA512() },
112
{
EncryptionAlgorithm
.AES_256_CBC, ValidationAlgorithm.HMACSHA512, () => new HMACSHA512() },
118
EncryptionAlgorithm
encryptionAlgorithm,
147
var descriptor = CreateDescriptor(
EncryptionAlgorithm
.AES_192_CBC, ValidationAlgorithm.HMACSHA512, masterKey.ToSecret());
170
var descriptor = CreateDescriptor(
EncryptionAlgorithm
.AES_192_GCM, ValidationAlgorithm.HMACSHA512, masterKey.ToSecret());
188
private static AuthenticatedEncryptorDescriptor CreateDescriptor(
EncryptionAlgorithm
encryptionAlgorithm, ValidationAlgorithm validationAlgorithm, ISecret masterKey)