70 references to EncryptionAlgorithm
Microsoft.AspNetCore.DataProtection (34)
AuthenticatedEncryption\AuthenticatedEncryptorFactory.cs (24)
108internal static bool IsGcmAlgorithm(EncryptionAlgorithm algorithm) 110return (EncryptionAlgorithm.AES_128_GCM <= algorithm && algorithm <= EncryptionAlgorithm.AES_256_GCM); 113private static int GetAlgorithmKeySizeInBits(EncryptionAlgorithm algorithm) 117case EncryptionAlgorithm.AES_128_CBC: 118case EncryptionAlgorithm.AES_128_GCM: 121case EncryptionAlgorithm.AES_192_CBC: 122case EncryptionAlgorithm.AES_192_GCM: 125case EncryptionAlgorithm.AES_256_CBC: 126case EncryptionAlgorithm.AES_256_GCM: 134private static string GetBCryptAlgorithmNameFromEncryptionAlgorithm(EncryptionAlgorithm algorithm) 138case EncryptionAlgorithm.AES_128_CBC: 139case EncryptionAlgorithm.AES_192_CBC: 140case EncryptionAlgorithm.AES_256_CBC: 141case EncryptionAlgorithm.AES_128_GCM: 142case EncryptionAlgorithm.AES_192_GCM: 143case EncryptionAlgorithm.AES_256_GCM: 167private static Type GetManagedTypeFromEncryptionAlgorithm(EncryptionAlgorithm algorithm) 171case EncryptionAlgorithm.AES_128_CBC: 172case EncryptionAlgorithm.AES_192_CBC: 173case EncryptionAlgorithm.AES_256_CBC: 174case EncryptionAlgorithm.AES_128_GCM: 175case EncryptionAlgorithm.AES_192_GCM: 176case EncryptionAlgorithm.AES_256_GCM:
AuthenticatedEncryption\CngCbcAuthenticatedEncryptorFactory.cs (1)
106throw Error.Common_PropertyCannotBeNullOrEmpty(nameof(EncryptionAlgorithm));
AuthenticatedEncryption\CngGcmAuthenticatedEncryptorFactory.cs (1)
73throw Error.Common_PropertyCannotBeNullOrEmpty(nameof(EncryptionAlgorithm));
AuthenticatedEncryption\ConfigurationModel\AuthenticatedEncryptorConfiguration.cs (3)
18/// The default value is <see cref="EncryptionAlgorithm.AES_256_CBC"/>. 20public EncryptionAlgorithm EncryptionAlgorithm { get; set; } = EncryptionAlgorithm.AES_256_CBC;
AuthenticatedEncryption\ConfigurationModel\AuthenticatedEncryptorDescriptorDeserializer.cs (2)
34configuration.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 (36)
AuthenticatedEncryption\ConfigurationModel\AuthenticatedEncryptorDescriptorDeserializerTests.cs (1)
23EncryptionAlgorithm = EncryptionAlgorithm.AES_192_CBC,
AuthenticatedEncryption\ConfigurationModel\AuthenticatedEncryptorDescriptorTests.cs (26)
25[InlineData(EncryptionAlgorithm.AES_128_CBC, ValidationAlgorithm.HMACSHA256)] 26[InlineData(EncryptionAlgorithm.AES_192_CBC, ValidationAlgorithm.HMACSHA256)] 27[InlineData(EncryptionAlgorithm.AES_256_CBC, ValidationAlgorithm.HMACSHA256)] 28[InlineData(EncryptionAlgorithm.AES_128_CBC, ValidationAlgorithm.HMACSHA512)] 29[InlineData(EncryptionAlgorithm.AES_192_CBC, ValidationAlgorithm.HMACSHA512)] 30[InlineData(EncryptionAlgorithm.AES_256_CBC, ValidationAlgorithm.HMACSHA512)] 31public void CreateAuthenticatedEncryptor_RoundTripsData_CngCbcImplementation(EncryptionAlgorithm encryptionAlgorithm, ValidationAlgorithm validationAlgorithm) 56[InlineData(EncryptionAlgorithm.AES_128_GCM)] 57[InlineData(EncryptionAlgorithm.AES_192_GCM)] 58[InlineData(EncryptionAlgorithm.AES_256_GCM)] 59public void CreateAuthenticatedEncryptor_RoundTripsData_CngGcmImplementation(EncryptionAlgorithm encryptionAlgorithm) 82[InlineData(EncryptionAlgorithm.AES_128_GCM)] 83[InlineData(EncryptionAlgorithm.AES_192_GCM)] 84[InlineData(EncryptionAlgorithm.AES_256_GCM)] 85public void CreateAuthenticatedEncryptor_RoundTripsData_AesGcmImplementation(EncryptionAlgorithm encryptionAlgorithm) 106public static TheoryData<EncryptionAlgorithm, ValidationAlgorithm, Func<HMAC>> CreateAuthenticatedEncryptor_RoundTripsData_ManagedImplementationData 109{ EncryptionAlgorithm.AES_128_CBC, ValidationAlgorithm.HMACSHA256, () => new HMACSHA256() }, 110{ EncryptionAlgorithm.AES_192_CBC, ValidationAlgorithm.HMACSHA256, () => new HMACSHA256() }, 111{ EncryptionAlgorithm.AES_256_CBC, ValidationAlgorithm.HMACSHA256, () => new HMACSHA256() }, 112{ EncryptionAlgorithm.AES_128_CBC, ValidationAlgorithm.HMACSHA512, () => new HMACSHA512() }, 113{ EncryptionAlgorithm.AES_192_CBC, ValidationAlgorithm.HMACSHA512, () => new HMACSHA512() }, 114{ EncryptionAlgorithm.AES_256_CBC, ValidationAlgorithm.HMACSHA512, () => new HMACSHA512() }, 120EncryptionAlgorithm encryptionAlgorithm, 149var descriptor = CreateDescriptor(EncryptionAlgorithm.AES_192_CBC, ValidationAlgorithm.HMACSHA512, masterKey.ToSecret()); 172var descriptor = CreateDescriptor(EncryptionAlgorithm.AES_192_GCM, ValidationAlgorithm.HMACSHA512, masterKey.ToSecret()); 190private static AuthenticatedEncryptorDescriptor CreateDescriptor(EncryptionAlgorithm encryptionAlgorithm, ValidationAlgorithm validationAlgorithm, ISecret masterKey)
KeyManagement\KeyRingBasedDataProtectorTests.cs (9)
637[InlineData("", EncryptionAlgorithm.AES_128_CBC, ValidationAlgorithm.HMACSHA256)] 638[InlineData("small", EncryptionAlgorithm.AES_128_CBC, ValidationAlgorithm.HMACSHA256)] 639[InlineData("This is a medium length plaintext message", EncryptionAlgorithm.AES_128_CBC, ValidationAlgorithm.HMACSHA256)] 640[InlineData("This is a very long plaintext message that spans multiple blocks and should test the encryption and size estimation with larger payloads to ensure everything works correctly", EncryptionAlgorithm.AES_128_CBC, ValidationAlgorithm.HMACSHA256)] 641[InlineData("small", EncryptionAlgorithm.AES_256_CBC, ValidationAlgorithm.HMACSHA256)] 642[InlineData("This is a medium length plaintext message", EncryptionAlgorithm.AES_256_CBC, ValidationAlgorithm.HMACSHA512)] 643[InlineData("small", EncryptionAlgorithm.AES_128_GCM, ValidationAlgorithm.HMACSHA256)] 644[InlineData("This is a medium length plaintext message", EncryptionAlgorithm.AES_256_GCM, ValidationAlgorithm.HMACSHA256)] 645public void GetProtectedSize_TryProtectUnprotect_CorrectlyEstimatesDataLength_MultipleScenarios(string plaintextStr, EncryptionAlgorithm encryptionAlgorithm, ValidationAlgorithm validationAlgorithm)