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