106 references to Advapi32
System.Security.Cryptography (106)
_generated\0\LibraryImports.g.cs (22)
94internal static partial bool CryptCreateHash(global::System.Security.Cryptography.SafeProvHandle hProv, int Algid, global::System.Security.Cryptography.SafeCapiKeyHandle hKey, global::Interop.Advapi32.CryptCreateHashFlags dwFlags, out global::System.Security.Cryptography.SafeHashHandle phHash) 149static extern unsafe int __PInvoke(nint __hProv_native, int __Algid_native, nint __hKey_native, global::Interop.Advapi32.CryptCreateHashFlags __dwFlags_native, nint* __phHash_native); 510public static partial bool CryptGetDefaultProvider(int dwProvType, nint pdwReserved, global::Interop.Advapi32.GetDefaultProviderFlags dwFlags, char[] pszProvName, ref int pcbProvName) 533static extern unsafe int __PInvoke(int __dwProvType_native, nint __pdwReserved_native, global::Interop.Advapi32.GetDefaultProviderFlags __dwFlags_native, char* __pszProvName_native, int* __pcbProvName_native); 543public static partial bool CryptGetHashParam(global::System.Security.Cryptography.SafeHashHandle hHash, global::Interop.Advapi32.CryptHashProperty dwParam, out int pbData, ref int pdwDataLen, int dwFlags) 583static extern unsafe int __PInvoke(nint __hHash_native, global::Interop.Advapi32.CryptHashProperty __dwParam_native, int* __pbData_native, int* __pdwDataLen_native, int __dwFlags_native); 593public static partial bool CryptSetHashParam(global::System.Security.Cryptography.SafeHashHandle hHash, global::Interop.Advapi32.CryptHashProperty dwParam, byte[] buffer, int dwFlags) 631static extern unsafe int __PInvoke(nint __hHash_native, global::Interop.Advapi32.CryptHashProperty __dwParam_native, byte* __buffer_native, int __dwFlags_native); 641public static partial bool CryptGetKeyParam(global::System.Security.Cryptography.SafeCapiKeyHandle hKey, global::Interop.Advapi32.CryptGetKeyParamFlags dwParam, byte[] pbData, ref int pdwDataLen, int dwFlags) 680static extern unsafe int __PInvoke(nint __hKey_native, global::Interop.Advapi32.CryptGetKeyParamFlags __dwParam_native, byte* __pbData_native, int* __pdwDataLen_native, int __dwFlags_native); 690public static partial bool CryptSetProvParam(global::System.Runtime.InteropServices.SafeHandle safeProvHandle, global::Interop.Advapi32.CryptProvParam dwParam, nint pbData, int dwFlags) 726static extern unsafe int __PInvoke(nint __safeProvHandle_native, global::Interop.Advapi32.CryptProvParam __dwParam_native, nint __pbData_native, int __dwFlags_native); 736public static partial bool CryptSetProvParam(global::System.Security.Cryptography.SafeProvHandle hProv, global::Interop.Advapi32.CryptProvParam dwParam, ref nint pbData, int dwFlags) 774static extern unsafe int __PInvoke(nint __hProv_native, global::Interop.Advapi32.CryptProvParam __dwParam_native, nint* __pbData_native, int __dwFlags_native); 784public static partial bool CryptGetProvParam(global::System.Runtime.InteropServices.SafeHandle safeProvHandle, global::Interop.Advapi32.CryptProvParam dwParam, nint pbData, ref int dwDataLen, int dwFlags) 822static extern unsafe int __PInvoke(nint __safeProvHandle_native, global::Interop.Advapi32.CryptProvParam __dwParam_native, nint __pbData_native, int* __dwDataLen_native, int __dwFlags_native); 1131public static partial bool CryptSignHash(global::System.Security.Cryptography.SafeHashHandle hHash, global::Interop.Advapi32.KeySpec dwKeySpec, string szDescription, global::Interop.Advapi32.CryptSignAndVerifyHashFlags dwFlags, byte[] pbSignature, ref int pdwSigLen) 1171static extern unsafe int __PInvoke(nint __hHash_native, global::Interop.Advapi32.KeySpec __dwKeySpec_native, ushort* __szDescription_native, global::Interop.Advapi32.CryptSignAndVerifyHashFlags __dwFlags_native, byte* __pbSignature_native, int* __pdwSigLen_native); 1181public static partial bool CryptVerifySignature(global::System.Security.Cryptography.SafeHashHandle hHash, byte[] pbSignature, int dwSigLen, global::System.Security.Cryptography.SafeCapiKeyHandle hPubKey, string szDescription, global::Interop.Advapi32.CryptSignAndVerifyHashFlags dwFlags) 1225static extern unsafe int __PInvoke(nint __hHash_native, byte* __pbSignature_native, int __dwSigLen_native, nint __hPubKey_native, ushort* __szDescription_native, global::Interop.Advapi32.CryptSignAndVerifyHashFlags __dwFlags_native);
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\SafeHashHandle.cs (1)
53bool successfullyFreed = Interop.Advapi32.CryptDestroyHash(handle);
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\SafeKeyHandle.cs (1)
88bool successfullyFreed = Interop.Advapi32.CryptDestroyKey(handle);
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\SafeProvHandle.cs (5)
106if (!_fPersistKeyInCsp && 0 == (_flags & (uint)Interop.Advapi32.CryptAcquireContextFlags.CRYPT_VERIFYCONTEXT)) 110uint flags = (_flags & (uint)Interop.Advapi32.CryptAcquireContextFlags.CRYPT_MACHINE_KEYSET) | (uint)Interop.Advapi32.CryptAcquireContextFlags.CRYPT_DELETEKEYSET; 112_ = Interop.Advapi32.CryptAcquireContext(out hIgnoredProv, _containerName, _providerName, _type, flags); 118bool successfullyFreed = Interop.Advapi32.CryptReleaseContext(handle, 0);
src\runtime\src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeCertContextHandleWithKeyContainerDeletion.cs (1)
77_ = Interop.Advapi32.CryptAcquireContext(out hProv, pProvInfo->pwszContainerName, pProvInfo->pwszProvName, pProvInfo->dwProvType, flags);
System\Security\Cryptography\CapiHelper.DSA.Windows.cs (1)
34(uint)Interop.Advapi32.CryptAcquireContextFlags.CRYPT_VERIFYCONTEXT))
System\Security\Cryptography\CapiHelper.Windows.cs (72)
12using CryptProvParam = Interop.Advapi32.CryptProvParam; 60dwProvType, (uint)Interop.Advapi32.CryptAcquireContextFlags.CRYPT_VERIFYCONTEXT)) 83if (!Interop.Advapi32.CryptGetDefaultProvider(dwType, IntPtr.Zero, 84Interop.Advapi32.GetDefaultProviderFlags.CRYPT_MACHINE_DEFAULT, 93if (!Interop.Advapi32.CryptGetDefaultProvider(dwType, IntPtr.Zero, 94Interop.Advapi32.GetDefaultProviderFlags.CRYPT_MACHINE_DEFAULT, 120uint dwFlags = (uint)Interop.Advapi32.CryptAcquireContextFlags.CRYPT_NEWKEYSET; 123dwFlags |= (uint)Interop.Advapi32.CryptAcquireContextFlags.CRYPT_VERIFYCONTEXT; 143const uint VerifyContextFlag = (uint)Interop.Advapi32.CryptAcquireContextFlags.CRYPT_VERIFYCONTEXT; 144const uint MachineContextFlag = (uint)Interop.Advapi32.CryptAcquireContextFlags.CRYPT_MACHINE_KEYSET; 157if (!Interop.Advapi32.CryptAcquireContext(out safeProvHandle, keyContainer, providerName, providerType, flags)) 182int ret = OpenCSP(cspParameters, (uint)Interop.Advapi32.CryptAcquireContextFlags.CRYPT_VERIFYCONTEXT, out hProv); 250if (IsFlagBitSet(flags, (uint)Interop.Advapi32.CryptAcquireContextFlags.CRYPT_VERIFYCONTEXT)) 293if (!Interop.Advapi32.CryptSetProvParam(safeProvHandle, CryptProvParam.PP_CLIENT_HWND, ref parentWindowHandle, 0)) 306(parameters.KeyNumber == (int)Interop.Advapi32.KeySpec.AT_SIGNATURE) ? 309if (!Interop.Advapi32.CryptSetProvParam(safeProvHandle, param, password, 0)) 344if (!Interop.Advapi32.CryptGetProvParam(safeProvHandle, flags, impType, ref cb)) 388if (!Interop.Advapi32.CryptGetKeyParam(safeKeyHandle, Interop.Advapi32.CryptGetKeyParamFlags.KP_PERMISSIONS, permissions, ref cb, 0)) 393retVal = IsFlagBitSet((uint)permissionsReturn, (uint)Interop.Advapi32.CryptGetKeyParamFlags.CRYPT_EXPORT); 519cspFlags |= (uint)Interop.Advapi32.CryptAcquireContextFlags.CRYPT_MACHINE_KEYSET; 523cspFlags |= (uint)Interop.Advapi32.CryptAcquireContextFlags.CRYPT_SILENT; 527cspFlags |= (uint)Interop.Advapi32.CryptAcquireContextFlags.CRYPT_VERIFYCONTEXT; 560if (!Interop.Advapi32.CryptGetKeyParam(safeKeyHandle, Interop.Advapi32.CryptGetKeyParamFlags.KP_KEYLEN, null, ref cb, 0)) 565if (!Interop.Advapi32.CryptGetKeyParam(safeKeyHandle, Interop.Advapi32.CryptGetKeyParamFlags.KP_KEYLEN, pb, ref cb, 0)) 580if (!Interop.Advapi32.CryptGetKeyParam(safeKeyHandle, Interop.Advapi32.CryptGetKeyParamFlags.KP_ALGID, null, ref cb, 0)) 585if (!Interop.Advapi32.CryptGetKeyParam(safeKeyHandle, Interop.Advapi32.CryptGetKeyParamFlags.KP_ALGID, pb, ref cb, 0)) 613if (!Interop.Advapi32.CryptSetKeyParam(safeKeyHandle, (int)keyParam, value, 0)) 638if (!Interop.Advapi32.CryptSetKeyParam(safeKeyHandle, (int)keyParam, ref value, 0)) 821int dwFlags = fOAEP ? (int)Interop.Advapi32.CryptDecryptFlags.CRYPT_OAEP : 0; 823if (!Interop.Advapi32.CryptDecrypt(safeKeyHandle, SafeHashHandle.InvalidHandle, true, dwFlags, dataToBeDecrypted, ref decryptedDataLength)) 831if ((uint)((uint)dwFlags & (uint)Interop.Advapi32.CryptDecryptFlags.CRYPT_OAEP) == (uint)Interop.Advapi32.CryptDecryptFlags.CRYPT_OAEP && 877int dwEncryptFlags = foep ? (int)Interop.Advapi32.CryptDecryptFlags.CRYPT_OAEP : 0; 880if (!Interop.Advapi32.CryptEncrypt(safeKeyHandle, SafeHashHandle.InvalidHandle, true, dwEncryptFlags, null, ref cbEncryptedKey, cbEncryptedKey)) 893if (!Interop.Advapi32.CryptEncrypt(safeKeyHandle, SafeHashHandle.InvalidHandle, true, dwEncryptFlags, pbEncryptedKey, ref cbKey, cbEncryptedKey)) 912if (!Interop.Advapi32.CryptEncrypt(hKey, SafeHashHandle.InvalidHandle, isFinal, 0, null, ref cbEncryptedData, cbEncryptedData)) 927if (!Interop.Advapi32.CryptEncrypt(hKey, SafeHashHandle.InvalidHandle, isFinal, 0, encryptedData, ref encryptedDataLength, cbEncryptedData)) 954if (!Interop.Advapi32.CryptDecrypt(hKey, SafeHashHandle.InvalidHandle, false, 0, dataToBeDecrypted, ref decryptedDataLength)) 1013if (!Interop.Advapi32.CryptExportKey(safeKeyHandle, SafeCapiKeyHandle.InvalidHandle, dwBlobType, 0, null, ref cbRawData)) 1019if (!Interop.Advapi32.CryptExportKey(safeKeyHandle, SafeCapiKeyHandle.InvalidHandle, dwBlobType, 0, pbRawData, ref cbRawData)) 1161if (!Interop.Advapi32.CryptSignHash(hHash, (Interop.Advapi32.KeySpec)keyNumber, null, Interop.Advapi32.CryptSignAndVerifyHashFlags.None, null, ref cbSignature)) 1168if (!Interop.Advapi32.CryptSignHash(hHash, (Interop.Advapi32.KeySpec)keyNumber, null, Interop.Advapi32.CryptSignAndVerifyHashFlags.None, signature, ref cbSignature)) 1218bool verified = Interop.Advapi32.CryptVerifySignature(hHash, signature, signature.Length, hKey, null, Interop.Advapi32.CryptSignAndVerifyHashFlags.None); 1241if (!CryptCreateHash(hProv, algidHash, SafeCapiKeyHandle.InvalidHandle, Interop.Advapi32.CryptCreateHashFlags.None, out hHash)) 1248if (!Interop.Advapi32.CryptHashData(hHash, password, cbPassword, 0)) 1268if (!Interop.Advapi32.CryptGetKeyParam(hKey, Interop.Advapi32.CryptGetKeyParamFlags.KP_IV, null, ref cbIV, 0)) 1276if (!Interop.Advapi32.CryptGetKeyParam(hKey, Interop.Advapi32.CryptGetKeyParamFlags.KP_IV, pbIV, ref cbIV, 0)) 1316if (!Interop.Advapi32.CryptExportKey(hKey, hPubKey, SIMPLEBLOB, 0, null, ref cbOut)) 1324if (!Interop.Advapi32.CryptExportKey(hKey, hPubKey, SIMPLEBLOB, 0, key_full, ref cbOut)) 1376if (!CryptCreateHash(hProv, calgHash, SafeCapiKeyHandle.InvalidHandle, Interop.Advapi32.CryptCreateHashFlags.None, out hHash)) 1389if (!Interop.Advapi32.CryptGetHashParam(hHash, Interop.Advapi32.CryptHashProperty.HP_HASHSIZE, out dwHashSize, ref cbHashSize, 0)) 1405if (!Interop.Advapi32.CryptSetHashParam(hHash, Interop.Advapi32.CryptHashProperty.HP_HASHVAL, hash, 0)) 1437bool response = Interop.Advapi32.CryptGetUserKey(safeProvHandle, dwKeySpec, out safeKeyHandle); 1450bool response = Interop.Advapi32.CryptGenKey(safeProvHandle, algId, dwFlags, out safeKeyHandle); 1466bool response = Interop.Advapi32.CryptImportKey(hProv, pbDataPtr, pbData.Length, hPubKey, dwFlags, out phKey); 1478Interop.Advapi32.CryptCreateHashFlags dwFlags, 1481bool response = Interop.Advapi32.CryptCreateHash(hProv, algId, hKey, dwFlags, out phHash); 1495bool response = Interop.Advapi32.CryptDeriveKey(hProv, algId, phHash, dwFlags, out phKey);
System\Security\Cryptography\CspKeyContainerInfo.Windows.cs (2)
200const uint SilentFlags = (uint)Interop.Advapi32.CryptAcquireContextFlags.CRYPT_SILENT; 235const uint OpenDeviceFlags = (uint)Interop.Advapi32.CryptAcquireContextFlags.CRYPT_VERIFYCONTEXT;
System\Security\Cryptography\RSACryptoServiceProvider.Windows.cs (1)
666if (_parameters.KeyNumber == (int)Interop.Advapi32.KeySpec.AT_KEYEXCHANGE)