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