65 references to BCryptAlgorithmHandle
Microsoft.AspNetCore.Cryptography.Internal (35)
Cng\CachedAlgorithmHandles.cs (25)
26public static BCryptAlgorithmHandle AES_CBC => CachedAlgorithmInfo.GetAlgorithmHandle(ref _aesCbc); 28public static BCryptAlgorithmHandle AES_GCM => CachedAlgorithmInfo.GetAlgorithmHandle(ref _aesGcm); 30public static BCryptAlgorithmHandle HMAC_SHA1 => CachedAlgorithmInfo.GetAlgorithmHandle(ref _hmacSha1); 32public static BCryptAlgorithmHandle HMAC_SHA256 => CachedAlgorithmInfo.GetAlgorithmHandle(ref _hmacSha256); 34public static BCryptAlgorithmHandle HMAC_SHA512 => CachedAlgorithmInfo.GetAlgorithmHandle(ref _hmacSha512); 37public static BCryptAlgorithmHandle PBKDF2 => CachedAlgorithmInfo.GetAlgorithmHandle(ref _pbkdf2); 39public static BCryptAlgorithmHandle SHA1 => CachedAlgorithmInfo.GetAlgorithmHandle(ref _sha1); 41public static BCryptAlgorithmHandle SHA256 => CachedAlgorithmInfo.GetAlgorithmHandle(ref _sha256); 43public static BCryptAlgorithmHandle SHA512 => CachedAlgorithmInfo.GetAlgorithmHandle(ref _sha512); 46public static BCryptAlgorithmHandle SP800_108_CTR_HMAC => CachedAlgorithmInfo.GetAlgorithmHandle(ref _sp800_108_ctr_hmac); 48private static BCryptAlgorithmHandle GetAesAlgorithm(string chainingMode) 50var algHandle = BCryptAlgorithmHandle.OpenAlgorithmHandle(Constants.BCRYPT_AES_ALGORITHM); 55private static BCryptAlgorithmHandle GetHashAlgorithm(string algorithm) 57return BCryptAlgorithmHandle.OpenAlgorithmHandle(algorithm, hmac: false); 60private static BCryptAlgorithmHandle GetHmacAlgorithm(string algorithm) 62return BCryptAlgorithmHandle.OpenAlgorithmHandle(algorithm, hmac: true); 65private static BCryptAlgorithmHandle GetPbkdf2Algorithm() 67return BCryptAlgorithmHandle.OpenAlgorithmHandle(Constants.BCRYPT_PBKDF2_ALGORITHM, implementation: Constants.MS_PRIMITIVE_PROVIDER); 70private static BCryptAlgorithmHandle GetSP800_108_CTR_HMACAlgorithm() 72return BCryptAlgorithmHandle.OpenAlgorithmHandle(Constants.BCRYPT_SP800108_CTR_HMAC_ALGORITHM, implementation: Constants.MS_PRIMITIVE_PROVIDER); 78private WeakReference<BCryptAlgorithmHandle>? _algorithmHandle; 79private readonly Func<BCryptAlgorithmHandle> _factory; 81public CachedAlgorithmInfo(Func<BCryptAlgorithmHandle> factory) 87public static BCryptAlgorithmHandle GetAlgorithmHandle(ref CachedAlgorithmInfo cachedAlgorithmInfo)
SafeHandles\BCryptAlgorithmHandle.cs (2)
130public static BCryptAlgorithmHandle OpenAlgorithmHandle(string algorithmId, string? implementation = null, bool hmac = false) 138BCryptAlgorithmHandle algHandle;
SafeHandles\BCryptHashHandle.cs (2)
10private BCryptAlgorithmHandle? _algProviderHandle; 65internal void SetAlgorithmProviderHandle(BCryptAlgorithmHandle algProviderHandle)
SafeHandles\BCryptKeyHandle.cs (2)
8private BCryptAlgorithmHandle? _algProviderHandle; 26internal void SetAlgorithmProviderHandle(BCryptAlgorithmHandle algProviderHandle)
UnsafeNativeMethods.cs (4)
51BCryptAlgorithmHandle hAlgorithm, 86BCryptAlgorithmHandle hPrf, 176BCryptAlgorithmHandle hAlgorithm, 248out BCryptAlgorithmHandle phAlgorithm,
Microsoft.AspNetCore.Cryptography.Internal.Tests (9)
Cng\CachedAlgorithmHandlesTests.cs (9)
107private static void RunAesBlockCipherAlgorithmTest(Func<BCryptAlgorithmHandle> getter) 110var algorithmHandle = getter(); 111var algorithmHandleSecondAttempt = getter(); 125Func<BCryptAlgorithmHandle> getter, 132var algorithmHandle = getter(); 133var algorithmHandleSecondAttempt = getter(); 156Func<BCryptAlgorithmHandle> getter, 163var algorithmHandle = getter(); 164var algorithmHandleSecondAttempt = getter();
Microsoft.AspNetCore.Cryptography.KeyDerivation (5)
PBKDF2\Win7Pbkdf2Provider.cs (2)
26var algHandle = PrfToCachedCngAlgorithmInstance(prf); 84private static BCryptAlgorithmHandle PrfToCachedCngAlgorithmInstance(KeyDerivationPrf prf)
PBKDF2\Win8Pbkdf2Provider.cs (3)
58private static BCryptKeyHandle PasswordToPbkdfKeyHandle(string password, BCryptAlgorithmHandle pbkdf2AlgHandle, KeyDerivationPrf prf) 98private static BCryptKeyHandle PasswordToPbkdfKeyHandleStep2(BCryptAlgorithmHandle pbkdf2AlgHandle, byte* pbPassword, uint cbPassword, KeyDerivationPrf prf) 112BCryptAlgorithmHandle prfAlgorithmHandle; // cached; don't dispose
Microsoft.AspNetCore.DataProtection (15)
AuthenticatedEncryption\CngCbcAuthenticatedEncryptorFactory.cs (6)
67private BCryptAlgorithmHandle GetHmacAlgorithmHandle(CngCbcAuthenticatedEncryptorConfiguration configuration) 76BCryptAlgorithmHandle? algorithmHandle = null; 89algorithmHandle = BCryptAlgorithmHandle.OpenAlgorithmHandle(configuration.HashAlgorithm, configuration.HashAlgorithmProvider, hmac: true); 101private BCryptAlgorithmHandle GetSymmetricBlockCipherAlgorithmHandle(CngCbcAuthenticatedEncryptorConfiguration configuration) 115BCryptAlgorithmHandle? algorithmHandle = null; 126algorithmHandle = BCryptAlgorithmHandle.OpenAlgorithmHandle(configuration.EncryptionAlgorithm, configuration.EncryptionAlgorithmProvider);
AuthenticatedEncryption\CngGcmAuthenticatedEncryptorFactory.cs (3)
68private BCryptAlgorithmHandle GetSymmetricBlockCipherAlgorithmHandle(CngGcmAuthenticatedEncryptorConfiguration configuration) 80BCryptAlgorithmHandle? algorithmHandle = null; 92algorithmHandle = BCryptAlgorithmHandle.OpenAlgorithmHandle(configuration.EncryptionAlgorithm, configuration.EncryptionAlgorithmProvider);
Cng\CbcAuthenticatedEncryptor.cs (4)
32private readonly BCryptAlgorithmHandle _hmacAlgorithmHandle; 36private readonly BCryptAlgorithmHandle _symmetricAlgorithmHandle; 40public CbcAuthenticatedEncryptor(Secret keyDerivationKey, BCryptAlgorithmHandle symmetricAlgorithmHandle, uint symmetricAlgorithmKeySizeInBytes, BCryptAlgorithmHandle hmacAlgorithmHandle, IBCryptGenRandom? genRandom = null)
Cng\CngGcmAuthenticatedEncryptor.cs (2)
37private readonly BCryptAlgorithmHandle _symmetricAlgorithmHandle; 40public CngGcmAuthenticatedEncryptor(Secret keyDerivationKey, BCryptAlgorithmHandle symmetricAlgorithmHandle, uint symmetricAlgorithmKeySizeInBytes, IBCryptGenRandom? genRandom = null)
Microsoft.AspNetCore.DataProtection.Tests (1)
AuthenticatedEncryption\ConfigurationModel\AuthenticatedEncryptorDescriptorTests.cs (1)
41hmacAlgorithmHandle: BCryptAlgorithmHandle.OpenAlgorithmHandle(hashAlgorithm, hmac: true));