68 references to SafeAlgorithmHandle
System.Security.Cryptography (68)
_generated\0\LibraryImports.g.cs (6)
1137
public static partial global::Interop.BCrypt.NTSTATUS BCryptOpenAlgorithmProvider(out global::Internal.NativeCrypto.
SafeAlgorithmHandle
phAlgorithm, string pszAlgId, string pszImplementation, int dwFlags)
1144
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Internal.NativeCrypto.
SafeAlgorithmHandle
>.ManagedToUnmanagedOut __phAlgorithm_native__marshaller = new();
1184
public static partial global::Interop.BCrypt.NTSTATUS BCryptSetProperty(global::Internal.NativeCrypto.
SafeAlgorithmHandle
hObject, string pszProperty, string pbInput, int cbInput, int dwFlags)
1189
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Internal.NativeCrypto.
SafeAlgorithmHandle
>.ManagedToUnmanagedIn __hObject_native__marshaller = new();
2135
private static unsafe partial global::Interop.BCrypt.NTSTATUS BCryptImportKey(global::Internal.NativeCrypto.
SafeAlgorithmHandle
hAlgorithm, nint hImportKey, string pszBlobType, out global::Internal.NativeCrypto.SafeKeyHandle hKey, nint pbKeyObject, int cbKeyObject, byte* pbInput, int cbInput, int dwFlags)
2144
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Internal.NativeCrypto.
SafeAlgorithmHandle
>.ManagedToUnmanagedIn __hAlgorithm_native__marshaller = new();
src\runtime\src\libraries\Common\src\Interop\Windows\BCrypt\AesBCryptModes.cs (8)
12
private static readonly Lazy<
SafeAlgorithmHandle
> s_hAlgCbc = OpenAesAlgorithm(Cng.BCRYPT_CHAIN_MODE_CBC);
13
private static readonly Lazy<
SafeAlgorithmHandle
> s_hAlgEcb = OpenAesAlgorithm(Cng.BCRYPT_CHAIN_MODE_ECB);
14
private static readonly Lazy<
SafeAlgorithmHandle
> s_hAlgCfb128 = OpenAesAlgorithm(Cng.BCRYPT_CHAIN_MODE_CFB, 16);
15
private static readonly Lazy<
SafeAlgorithmHandle
> s_hAlgCfb8 = OpenAesAlgorithm(Cng.BCRYPT_CHAIN_MODE_CFB, 1);
17
internal static
SafeAlgorithmHandle
GetSharedHandle(CipherMode cipherMode, int feedback) =>
29
internal static Lazy<
SafeAlgorithmHandle
> OpenAesAlgorithm(string cipherMode, int feedback = 0)
31
return new Lazy<
SafeAlgorithmHandle
>(() =>
33
SafeAlgorithmHandle
hAlg = Cng.BCryptOpenAlgorithmProvider(Cng.BCRYPT_AES_ALGORITHM, null,
src\runtime\src\libraries\Common\src\Interop\Windows\BCrypt\BCryptAeadHandleCache.cs (10)
13
private static
SafeAlgorithmHandle
? s_aesGcm;
15
private static
SafeAlgorithmHandle
? s_aesCcm;
16
private static
SafeAlgorithmHandle
? s_chaCha20Poly1305;
19
internal static
SafeAlgorithmHandle
ChaCha20Poly1305 => GetCachedAlgorithmHandle(ref s_chaCha20Poly1305, Cng.BCRYPT_CHACHA20_POLY1305_ALGORITHM);
20
internal static
SafeAlgorithmHandle
AesCcm => GetCachedAlgorithmHandle(ref s_aesCcm, Cng.BCRYPT_AES_ALGORITHM, Cng.BCRYPT_CHAIN_MODE_CCM);
23
internal static
SafeAlgorithmHandle
AesGcm => GetCachedAlgorithmHandle(ref s_aesGcm, Cng.BCRYPT_AES_ALGORITHM, Cng.BCRYPT_CHAIN_MODE_GCM);
25
private static
SafeAlgorithmHandle
GetCachedAlgorithmHandle(ref
SafeAlgorithmHandle
? handle, string algId, string? chainingMode = null)
28
SafeAlgorithmHandle
? existingHandle = Volatile.Read(ref handle);
36
SafeAlgorithmHandle
newHandle = Cng.BCryptOpenAlgorithmProvider(algId, null, Cng.OpenAlgorithmProviderFlags.NONE);
src\runtime\src\libraries\Common\src\Interop\Windows\BCrypt\Cng.cs (9)
77
public static
SafeAlgorithmHandle
BCryptOpenAlgorithmProvider(
82
SafeAlgorithmHandle
hAlgorithm;
89
public static void SetFeedbackSize(this
SafeAlgorithmHandle
hAlg, int dwFeedbackSize)
99
public static void SetCipherMode(this
SafeAlgorithmHandle
hAlg, string cipherMode)
109
public static void SetEffectiveKeyLength(this
SafeAlgorithmHandle
hAlg, int effectiveKeyLength)
132
public static partial NTSTATUS BCryptOpenAlgorithmProvider(out
SafeAlgorithmHandle
phAlgorithm, string pszAlgId, string? pszImplementation, int dwFlags);
135
public static partial NTSTATUS BCryptSetProperty(
SafeAlgorithmHandle
hObject, string pszProperty, string pbInput, int cbInput, int dwFlags);
164
private
SafeAlgorithmHandle
? _parentHandle;
166
public void SetParentHandle(
SafeAlgorithmHandle
parentHandle)
src\runtime\src\libraries\Common\src\Interop\Windows\BCrypt\DESBCryptModes.cs (7)
12
private static readonly Lazy<
SafeAlgorithmHandle
> s_hAlgCbc = OpenDesAlgorithm(Cng.BCRYPT_CHAIN_MODE_CBC);
13
private static readonly Lazy<
SafeAlgorithmHandle
> s_hAlgEcb = OpenDesAlgorithm(Cng.BCRYPT_CHAIN_MODE_ECB);
14
private static readonly Lazy<
SafeAlgorithmHandle
> s_hAlgCfb8 = OpenDesAlgorithm(Cng.BCRYPT_CHAIN_MODE_CFB);
16
internal static
SafeAlgorithmHandle
GetSharedHandle(CipherMode cipherMode, int feedback) =>
27
private static Lazy<
SafeAlgorithmHandle
> OpenDesAlgorithm(string cipherMode)
29
return new Lazy<
SafeAlgorithmHandle
>(() =>
31
SafeAlgorithmHandle
hAlg = Cng.BCryptOpenAlgorithmProvider(
src\runtime\src\libraries\Common\src\Interop\Windows\BCrypt\Interop.BCryptImportKey.cs (2)
14
internal static unsafe SafeKeyHandle BCryptImportKey(
SafeAlgorithmHandle
hAlg, ReadOnlySpan<byte> key)
65
private static unsafe partial NTSTATUS BCryptImportKey(
SafeAlgorithmHandle
hAlgorithm, IntPtr hImportKey, string pszBlobType, out SafeKeyHandle hKey, IntPtr pbKeyObject, int cbKeyObject, byte* pbInput, int cbInput, int dwFlags);
src\runtime\src\libraries\Common\src\Interop\Windows\BCrypt\RC2BCryptModes.cs (3)
13
internal static
SafeAlgorithmHandle
GetHandle(CipherMode cipherMode, int effectiveKeyLength) =>
25
private static
SafeAlgorithmHandle
OpenRC2Algorithm(string cipherMode, int effectiveKeyLength)
27
SafeAlgorithmHandle
hAlg = Cng.BCryptOpenAlgorithmProvider(Cng.BCRYPT_RC2_ALGORITHM, null, Cng.OpenAlgorithmProviderFlags.NONE);
src\runtime\src\libraries\Common\src\Interop\Windows\BCrypt\TripleDesBCryptModes.cs (8)
13
private static readonly Lazy<
SafeAlgorithmHandle
> s_hAlgCbc = Open3DesAlgorithm(Cng.BCRYPT_CHAIN_MODE_CBC);
15
private static readonly Lazy<
SafeAlgorithmHandle
> s_hAlgEcb = Open3DesAlgorithm(Cng.BCRYPT_CHAIN_MODE_ECB);
17
private static readonly Lazy<
SafeAlgorithmHandle
> s_hAlgCfb8 = Open3DesAlgorithm(Cng.BCRYPT_CHAIN_MODE_CFB, 1);
19
private static readonly Lazy<
SafeAlgorithmHandle
> s_hAlgCfb64 = Open3DesAlgorithm(Cng.BCRYPT_CHAIN_MODE_CFB, 8);
21
internal static
SafeAlgorithmHandle
GetSharedHandle(CipherMode cipherMode, int feedback) =>
33
private static Lazy<
SafeAlgorithmHandle
> Open3DesAlgorithm(string cipherMode, int feedback = 0)
35
return new Lazy<
SafeAlgorithmHandle
>(() =>
37
SafeAlgorithmHandle
hAlg = Cng.BCryptOpenAlgorithmProvider(Cng.BCRYPT_3DES_ALGORITHM, null,
System\Security\Cryptography\AesCng.Windows.cs (1)
271
SafeAlgorithmHandle
ICngSymmetricAlgorithm.GetEphemeralModeHandle(CipherMode mode, int feedbackSizeInBits)
System\Security\Cryptography\AesImplementation.Windows.cs (2)
21
SafeAlgorithmHandle
algorithm = AesBCryptModes.GetSharedHandle(cipherMode, feedbackSize);
36
SafeAlgorithmHandle
algorithm = AesBCryptModes.GetSharedHandle(cipherMode, feedbackSize);
System\Security\Cryptography\BasicSymmetricCipherBCrypt.cs (1)
15
public BasicSymmetricCipherBCrypt(
SafeAlgorithmHandle
algorithm, CipherMode cipherMode, int blockSizeInBytes, int paddingSizeInBytes, ReadOnlySpan<byte> key, bool ownsParentHandle, byte[]? iv, bool encrypting)
System\Security\Cryptography\BasicSymmetricCipherLiteBCrypt.cs (1)
20
SafeAlgorithmHandle
algorithm,
System\Security\Cryptography\CngSymmetricAlgorithmCore.cs (2)
183
SafeAlgorithmHandle
algorithmModeHandle = _outer.GetEphemeralModeHandle(mode, feedbackSizeInBits);
217
SafeAlgorithmHandle
algorithmModeHandle = _outer.GetEphemeralModeHandle(mode, feedbackSizeInBits);
System\Security\Cryptography\DesImplementation.Windows.cs (2)
21
SafeAlgorithmHandle
algorithm = DesBCryptModes.GetSharedHandle(cipherMode, feedbackSize);
36
SafeAlgorithmHandle
algorithm = DesBCryptModes.GetSharedHandle(cipherMode, feedbackSize);
System\Security\Cryptography\ICngSymmetricAlgorithm.cs (1)
30
SafeAlgorithmHandle
GetEphemeralModeHandle(CipherMode mode, int feedbackSizeInBits);
System\Security\Cryptography\RC2Implementation.Windows.cs (2)
21
using (
SafeAlgorithmHandle
algorithm = RC2BCryptModes.GetHandle(cipherMode, key.Length * 8))
37
using (
SafeAlgorithmHandle
algorithm = RC2BCryptModes.GetHandle(cipherMode, key.Length * 8))
System\Security\Cryptography\TripleDESCng.Windows.cs (1)
233
SafeAlgorithmHandle
ICngSymmetricAlgorithm.GetEphemeralModeHandle(CipherMode mode, int feedbackSizeInBits)
System\Security\Cryptography\TripleDesImplementation.Windows.cs (2)
21
SafeAlgorithmHandle
algorithm = TripleDesBCryptModes.GetSharedHandle(cipherMode, feedbackSize);
36
SafeAlgorithmHandle
algorithm = TripleDesBCryptModes.GetSharedHandle(cipherMode, feedbackSize);