43 references to Constants
Microsoft.AspNetCore.Cryptography.Internal (20)
Cng\CachedAlgorithmHandles.cs (13)
15private static CachedAlgorithmInfo _aesCbc = new CachedAlgorithmInfo(() => GetAesAlgorithm(chainingMode: Constants.BCRYPT_CHAIN_MODE_CBC)); 16private static CachedAlgorithmInfo _aesGcm = new CachedAlgorithmInfo(() => GetAesAlgorithm(chainingMode: Constants.BCRYPT_CHAIN_MODE_GCM)); 17private static CachedAlgorithmInfo _hmacSha1 = new CachedAlgorithmInfo(() => GetHmacAlgorithm(algorithm: Constants.BCRYPT_SHA1_ALGORITHM)); 18private static CachedAlgorithmInfo _hmacSha256 = new CachedAlgorithmInfo(() => GetHmacAlgorithm(algorithm: Constants.BCRYPT_SHA256_ALGORITHM)); 19private static CachedAlgorithmInfo _hmacSha512 = new CachedAlgorithmInfo(() => GetHmacAlgorithm(algorithm: Constants.BCRYPT_SHA512_ALGORITHM)); 21private static CachedAlgorithmInfo _sha1 = new CachedAlgorithmInfo(() => GetHashAlgorithm(algorithm: Constants.BCRYPT_SHA1_ALGORITHM)); 22private static CachedAlgorithmInfo _sha256 = new CachedAlgorithmInfo(() => GetHashAlgorithm(algorithm: Constants.BCRYPT_SHA256_ALGORITHM)); 23private static CachedAlgorithmInfo _sha512 = new CachedAlgorithmInfo(() => GetHashAlgorithm(algorithm: Constants.BCRYPT_SHA512_ALGORITHM)); 50var algHandle = BCryptAlgorithmHandle.OpenAlgorithmHandle(Constants.BCRYPT_AES_ALGORITHM); 67return BCryptAlgorithmHandle.OpenAlgorithmHandle(Constants.BCRYPT_PBKDF2_ALGORITHM, implementation: Constants.MS_PRIMITIVE_PROVIDER); 72return BCryptAlgorithmHandle.OpenAlgorithmHandle(Constants.BCRYPT_SP800108_CTR_HMAC_ALGORITHM, implementation: Constants.MS_PRIMITIVE_PROVIDER);
SafeHandles\BCryptAlgorithmHandle.cs (7)
71uint byteLengthOfNameWithTerminatingNull = GetProperty(Constants.BCRYPT_ALGORITHM_NAME, null, 0); 81uint numBytesCopied = GetProperty(Constants.BCRYPT_ALGORITHM_NAME, pBuffer, byteLengthOfNameWithTerminatingNull); 92uint numBytesCopied = GetProperty(Constants.BCRYPT_BLOCK_LENGTH, &cipherBlockLength, sizeof(uint)); 103uint numBytesCopied = GetProperty(Constants.BCRYPT_HASH_BLOCK_LENGTH, &hashBlockLength, sizeof(uint)); 114uint numBytesCopied = GetProperty(Constants.BCRYPT_KEY_LENGTHS, &supportedKeyLengths, (uint)sizeof(BCRYPT_KEY_LENGTHS_STRUCT)); 125uint numBytesCopied = GetProperty(Constants.BCRYPT_HASH_LENGTH, &digestLength, sizeof(uint)); 163SetProperty(Constants.BCRYPT_CHAINING_MODE, pszChainingMode, checked((uint)(chainingMode.Length + 1 /* null terminator */) * sizeof(char)));
Microsoft.AspNetCore.Cryptography.KeyDerivation (5)
PBKDF2\Win7Pbkdf2Provider.cs (1)
31fixed (byte* pbHeapAllocatedPasswordBuffer = (cbPasswordBuffer > Constants.MAX_STACKALLOC_BYTES) ? new byte[cbPasswordBuffer] : null)
PBKDF2\Win8Pbkdf2Provider.cs (4)
65fixed (byte* pbHeapAllocatedPasswordBuffer = (cbPasswordBuffer > Constants.MAX_STACKALLOC_BYTES) ? new byte[cbPasswordBuffer] : null) 201return Constants.BCRYPT_SHA1_ALGORITHM; 203return Constants.BCRYPT_SHA256_ALGORITHM; 205return Constants.BCRYPT_SHA512_ALGORITHM;
Microsoft.AspNetCore.DataProtection (15)
AuthenticatedEncryption\AlgorithmAssert.cs (1)
22private const uint MAX_SIZE_IN_BITS = Constants.MAX_STACKALLOC_BYTES * 8;
AuthenticatedEncryption\AuthenticatedEncryptorFactory.cs (3)
144return Constants.BCRYPT_AES_ALGORITHM; 156return Constants.BCRYPT_SHA256_ALGORITHM; 159return Constants.BCRYPT_SHA512_ALGORITHM;
AuthenticatedEncryption\CngCbcAuthenticatedEncryptorFactory.cs (5)
81if (configuration.HashAlgorithm == Constants.BCRYPT_SHA1_ALGORITHM) { algorithmHandle = CachedAlgorithmHandles.HMAC_SHA1; } 82else if (configuration.HashAlgorithm == Constants.BCRYPT_SHA256_ALGORITHM) { algorithmHandle = CachedAlgorithmHandles.HMAC_SHA256; } 83else if (configuration.HashAlgorithm == Constants.BCRYPT_SHA512_ALGORITHM) { algorithmHandle = CachedAlgorithmHandles.HMAC_SHA512; } 120if (configuration.EncryptionAlgorithm == Constants.BCRYPT_AES_ALGORITHM) { algorithmHandle = CachedAlgorithmHandles.AES_CBC; } 127algorithmHandle.SetChainingMode(Constants.BCRYPT_CHAIN_MODE_CBC);
AuthenticatedEncryption\CngGcmAuthenticatedEncryptorFactory.cs (2)
86if (configuration.EncryptionAlgorithm == Constants.BCRYPT_AES_ALGORITHM) { algorithmHandle = CachedAlgorithmHandles.AES_GCM; } 93algorithmHandle.SetChainingMode(Constants.BCRYPT_CHAIN_MODE_GCM);
AuthenticatedEncryption\ConfigurationModel\CngCbcAuthenticatedEncryptorConfiguration.cs (2)
28public string EncryptionAlgorithm { get; set; } = Constants.BCRYPT_AES_ALGORITHM; 63public string HashAlgorithm { get; set; } = Constants.BCRYPT_SHA256_ALGORITHM;
AuthenticatedEncryption\ConfigurationModel\CngGcmAuthenticatedEncryptorConfiguration.cs (1)
28public string EncryptionAlgorithm { get; set; } = Constants.BCRYPT_AES_ALGORITHM;
SP800_108\SP800_108_CTR_HMACSHA512Extensions.cs (1)
15byte[]? heapAllocatedCombinedContext = (cbCombinedContext > Constants.MAX_STACKALLOC_BYTES) ? new byte[cbCombinedContext] : null;
Microsoft.AspNetCore.DataProtection.Tests (3)
AuthenticatedEncryption\ConfigurationModel\CngCbcAuthenticatedEncryptorDescriptorDeserializerTests.cs (2)
25EncryptionAlgorithm = Constants.BCRYPT_AES_ALGORITHM, 28HashAlgorithm = Constants.BCRYPT_SHA512_ALGORITHM,
AuthenticatedEncryption\ConfigurationModel\CngGcmAuthenticatedEncryptorDescriptorDeserializerTests.cs (1)
25EncryptionAlgorithm = Constants.BCRYPT_AES_ALGORITHM,