1572 references to Interop
System.Security.Cryptography (1572)
_generated\0\LibraryImports.g.cs (452)
58internal static unsafe partial bool CryptAcquireContext(out nint psafeProvHandle, char* pszContainer, char* pszProvider, int dwProvType, global::Interop.Crypt32.CryptAcquireContextFlags dwFlags) 79static extern unsafe int __PInvoke(nint* __psafeProvHandle_native, char* __pszContainer_native, char* __pszProvider_native, int __dwProvType_native, global::Interop.Crypt32.CryptAcquireContextFlags __dwFlags_native); 88internal 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) 141static extern unsafe int __PInvoke(nint __hProv_native, int __Algid_native, nint __hKey_native, global::Interop.Advapi32.CryptCreateHashFlags __dwFlags_native, nint* __phHash_native); 480public static partial bool CryptGetDefaultProvider(int dwProvType, nint pdwReserved, global::Interop.Advapi32.GetDefaultProviderFlags dwFlags, char[] pszProvName, ref int pcbProvName) 501static extern unsafe int __PInvoke(int __dwProvType_native, nint __pdwReserved_native, global::Interop.Advapi32.GetDefaultProviderFlags __dwFlags_native, char* __pszProvName_native, int* __pcbProvName_native); 510public static partial bool CryptGetHashParam(global::System.Security.Cryptography.SafeHashHandle hHash, global::Interop.Advapi32.CryptHashProperty dwParam, out int pbData, ref int pdwDataLen, int dwFlags) 548static extern unsafe int __PInvoke(nint __hHash_native, global::Interop.Advapi32.CryptHashProperty __dwParam_native, int* __pbData_native, int* __pdwDataLen_native, int __dwFlags_native); 557public static partial bool CryptSetHashParam(global::System.Security.Cryptography.SafeHashHandle hHash, global::Interop.Advapi32.CryptHashProperty dwParam, byte[] buffer, int dwFlags) 593static extern unsafe int __PInvoke(nint __hHash_native, global::Interop.Advapi32.CryptHashProperty __dwParam_native, byte* __buffer_native, int __dwFlags_native); 602public static partial bool CryptGetKeyParam(global::System.Security.Cryptography.SafeCapiKeyHandle hKey, global::Interop.Advapi32.CryptGetKeyParamFlags dwParam, byte[] pbData, ref int pdwDataLen, int dwFlags) 639static extern unsafe int __PInvoke(nint __hKey_native, global::Interop.Advapi32.CryptGetKeyParamFlags __dwParam_native, byte* __pbData_native, int* __pdwDataLen_native, int __dwFlags_native); 648public static partial bool CryptSetProvParam(global::System.Runtime.InteropServices.SafeHandle safeProvHandle, global::Interop.Advapi32.CryptProvParam dwParam, nint pbData, int dwFlags) 682static extern unsafe int __PInvoke(nint __safeProvHandle_native, global::Interop.Advapi32.CryptProvParam __dwParam_native, nint __pbData_native, int __dwFlags_native); 691public static partial bool CryptSetProvParam(global::System.Security.Cryptography.SafeProvHandle hProv, global::Interop.Advapi32.CryptProvParam dwParam, ref nint pbData, int dwFlags) 727static extern unsafe int __PInvoke(nint __hProv_native, global::Interop.Advapi32.CryptProvParam __dwParam_native, nint* __pbData_native, int __dwFlags_native); 736public static partial bool CryptGetProvParam(global::System.Runtime.InteropServices.SafeHandle safeProvHandle, global::Interop.Advapi32.CryptProvParam dwParam, nint pbData, ref int dwDataLen, int dwFlags) 772static extern unsafe int __PInvoke(nint __safeProvHandle_native, global::Interop.Advapi32.CryptProvParam __dwParam_native, nint __pbData_native, int* __dwDataLen_native, int __dwFlags_native); 1062public 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) 1100static 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); 1109public 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) 1151static 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); 1162public static partial global::Interop.BCrypt.NTSTATUS BCryptOpenAlgorithmProvider(out global::Internal.NativeCrypto.SafeAlgorithmHandle phAlgorithm, string pszAlgId, string pszImplementation, int dwFlags) 1167global::Interop.BCrypt.NTSTATUS __retVal = default; 1198static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint* __phAlgorithm_native, ushort* __pszAlgId_native, ushort* __pszImplementation_native, int __dwFlags_native); 1210public static partial global::Interop.BCrypt.NTSTATUS BCryptSetProperty(global::Internal.NativeCrypto.SafeAlgorithmHandle hObject, string pszProperty, string pbInput, int cbInput, int dwFlags) 1213global::Interop.BCrypt.NTSTATUS __retVal = default; 1239static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hObject_native, ushort* __pszProperty_native, ushort* __pbInput_native, int __cbInput_native, int __dwFlags_native); 1251private static partial global::Interop.BCrypt.NTSTATUS BCryptSetIntPropertyPrivate(global::Microsoft.Win32.SafeHandles.SafeBCryptHandle hObject, string pszProperty, ref int pdwInput, int cbInput, int dwFlags) 1254global::Interop.BCrypt.NTSTATUS __retVal = default; 1280static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hObject_native, ushort* __pszProperty_native, int* __pdwInput_native, int __cbInput_native, int __dwFlags_native); 1292public static partial global::Interop.BCrypt.NTSTATUS BCryptSetProperty(global::Microsoft.Win32.SafeHandles.SafeBCryptHandle hObject, string pszProperty, global::System.ReadOnlySpan<byte> pbInput, int cbInput, int dwFlags) 1295global::Interop.BCrypt.NTSTATUS __retVal = default; 1321static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hObject_native, ushort* __pszProperty_native, byte* __pbInput_native, int __cbInput_native, int __dwFlags_native); 1347internal static extern partial global::Interop.BCrypt.NTSTATUS BCryptCloseAlgorithmProvider(nint hAlgorithm, int dwFlags); 1355internal static partial global::Interop.BCrypt.NTSTATUS BCryptCreateHash(global::Microsoft.Win32.SafeHandles.SafeBCryptAlgorithmHandle hAlgorithm, out global::Microsoft.Win32.SafeHandles.SafeBCryptHashHandle phHash, nint pbHashObject, int cbHashObject, global::System.ReadOnlySpan<byte> secret, int cbSecret, global::Interop.BCrypt.BCryptCreateHashFlags dwFlags) 1361global::Interop.BCrypt.NTSTATUS __retVal = default; 1399static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hAlgorithm_native, nint* __phHash_native, nint __pbHashObject_native, int __cbHashObject_native, byte* __secret_native, int __cbSecret_native, global::Interop.BCrypt.BCryptCreateHashFlags __dwFlags_native); 1408internal static partial global::Interop.BCrypt.NTSTATUS BCryptCreateHash(nuint hAlgorithm, out global::Microsoft.Win32.SafeHandles.SafeBCryptHashHandle phHash, nint pbHashObject, int cbHashObject, global::System.ReadOnlySpan<byte> secret, int cbSecret, global::Interop.BCrypt.BCryptCreateHashFlags dwFlags) 1413global::Interop.BCrypt.NTSTATUS __retVal = default; 1443static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nuint __hAlgorithm_native, nint* __phHash_native, nint __pbHashObject_native, int __cbHashObject_native, byte* __secret_native, int __cbSecret_native, global::Interop.BCrypt.BCryptCreateHashFlags __dwFlags_native); 1452private static unsafe partial global::Interop.BCrypt.NTSTATUS BCryptDecapsulate(global::Microsoft.Win32.SafeHandles.SafeBCryptKeyHandle hKey, byte* pbCipherText, uint cbCipherText, byte* pbSecretKey, uint cbSecretKey, out uint pcbSecretKey, uint dwFlags) 1456global::Interop.BCrypt.NTSTATUS __retVal = default; 1481static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hKey_native, byte* __pbCipherText_native, uint __cbCipherText_native, byte* __pbSecretKey_native, uint __cbSecretKey_native, uint* __pcbSecretKey_native, uint __dwFlags_native); 1490private static unsafe partial global::Interop.BCrypt.NTSTATUS BCryptEncapsulate(global::Microsoft.Win32.SafeHandles.SafeBCryptKeyHandle hKey, byte* pbSecretKey, uint cbSecretKey, out uint pcbSecretKey, byte* pbCipherText, uint cbCipherText, out uint pcbCipherText, uint dwFlags) 1495global::Interop.BCrypt.NTSTATUS __retVal = default; 1521static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hKey_native, byte* __pbSecretKey_native, uint __cbSecretKey_native, uint* __pcbSecretKey_native, byte* __pbCipherText_native, uint __cbCipherText_native, uint* __pcbCipherText_native, uint __dwFlags_native); 1530private static unsafe partial global::Interop.BCrypt.NTSTATUS BCryptDeriveKey(global::Microsoft.Win32.SafeHandles.SafeBCryptSecretHandle hSharedSecret, string pwszKDF, ref readonly global::Interop.BCrypt.BCryptBufferDesc pParameterList, byte* pbDerivedKey, uint cbDerivedKey, out uint pcbResult, uint dwFlags) 1534global::Interop.BCrypt.NTSTATUS __retVal = default; 1543fixed (global::Interop.BCrypt.BCryptBufferDesc* __pParameterList_native = &pParameterList) 1561static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hSharedSecret_native, ushort* __pwszKDF_native, global::Interop.BCrypt.BCryptBufferDesc* __pParameterList_native, byte* __pbDerivedKey_native, uint __cbDerivedKey_native, uint* __pcbResult_native, uint __dwFlags_native); 1570internal static extern partial global::Interop.BCrypt.NTSTATUS BCryptDestroyHash(nint hHash); 1578internal static extern partial global::Interop.BCrypt.NTSTATUS BCryptDestroyKey(nint hKey); 1586internal static extern partial global::Interop.BCrypt.NTSTATUS BCryptDestroySecret(nint hSecret); 1594private static partial global::Interop.BCrypt.NTSTATUS BCryptDuplicateHash(global::Microsoft.Win32.SafeHandles.SafeBCryptHashHandle hHash, out global::Microsoft.Win32.SafeHandles.SafeBCryptHashHandle phNewHash, nint pbHashObject, int cbHashObject, int dwFlags) 1600global::Interop.BCrypt.NTSTATUS __retVal = default; 1636static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hHash_native, nint* __phNewHash_native, nint __pbHashObject_native, int __cbHashObject_native, int __dwFlags_native); 1645public static unsafe partial global::Interop.BCrypt.NTSTATUS BCryptEncrypt(global::Internal.NativeCrypto.SafeKeyHandle hKey, byte* pbInput, int cbInput, nint paddingInfo, byte[] pbIV, int cbIV, byte* pbOutput, int cbOutput, out int cbResult, int dwFlags) 1649global::Interop.BCrypt.NTSTATUS __retVal = default; 1675static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hKey_native, byte* __pbInput_native, int __cbInput_native, nint __paddingInfo_native, byte* __pbIV_native, int __cbIV_native, byte* __pbOutput_native, int __cbOutput_native, int* __cbResult_native, int __dwFlags_native); 1684public static unsafe partial global::Interop.BCrypt.NTSTATUS BCryptDecrypt(global::Internal.NativeCrypto.SafeKeyHandle hKey, byte* pbInput, int cbInput, nint paddingInfo, byte[] pbIV, int cbIV, byte* pbOutput, int cbOutput, out int cbResult, int dwFlags) 1688global::Interop.BCrypt.NTSTATUS __retVal = default; 1714static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hKey_native, byte* __pbInput_native, int __cbInput_native, nint __paddingInfo_native, byte* __pbIV_native, int __cbIV_native, byte* __pbOutput_native, int __cbOutput_native, int* __cbResult_native, int __dwFlags_native); 1723private static unsafe partial global::Interop.BCrypt.NTSTATUS BCryptEncrypt(global::Microsoft.Win32.SafeHandles.SafeBCryptKeyHandle hKey, byte* pbInput, int cbInput, void* paddingInfo, byte* pbIV, int cbIV, byte* pbOutput, int cbOutput, out int cbResult, global::Interop.BCrypt.BCryptEncryptFlags dwFlags) 1727global::Interop.BCrypt.NTSTATUS __retVal = default; 1752static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hKey_native, byte* __pbInput_native, int __cbInput_native, void* __paddingInfo_native, byte* __pbIV_native, int __cbIV_native, byte* __pbOutput_native, int __cbOutput_native, int* __cbResult_native, global::Interop.BCrypt.BCryptEncryptFlags __dwFlags_native); 1761private static unsafe partial global::Interop.BCrypt.NTSTATUS BCryptDecrypt(global::Microsoft.Win32.SafeHandles.SafeBCryptKeyHandle hKey, byte* pbInput, int cbInput, void* paddingInfo, byte* pbIV, int cbIV, byte* pbOutput, int cbOutput, out int cbResult, global::Interop.BCrypt.BCryptEncryptFlags dwFlags) 1765global::Interop.BCrypt.NTSTATUS __retVal = default; 1790static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hKey_native, byte* __pbInput_native, int __cbInput_native, void* __paddingInfo_native, byte* __pbIV_native, int __cbIV_native, byte* __pbOutput_native, int __cbOutput_native, int* __cbResult_native, global::Interop.BCrypt.BCryptEncryptFlags __dwFlags_native); 1799private static partial global::Interop.BCrypt.NTSTATUS BCryptExportKey(global::Microsoft.Win32.SafeHandles.SafeBCryptKeyHandle hKey, nint hExportKey, string pszBlobType, byte[] pbOutput, int cbOutput, out int pcbResult, int dwFlags) 1803global::Interop.BCrypt.NTSTATUS __retVal = default; 1830static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hKey_native, nint __hExportKey_native, ushort* __pszBlobType_native, byte* __pbOutput_native, int __cbOutput_native, int* __pcbResult_native, int __dwFlags_native); 1839private static unsafe partial global::Interop.BCrypt.NTSTATUS BCryptFinalizeKeyPair(global::Microsoft.Win32.SafeHandles.SafeBCryptKeyHandle hKey, uint dwFlags) 1842global::Interop.BCrypt.NTSTATUS __retVal = default; 1865static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hKey_native, uint __dwFlags_native); 1874internal static partial global::Interop.BCrypt.NTSTATUS BCryptFinishHash(global::Microsoft.Win32.SafeHandles.SafeBCryptHashHandle hHash, global::System.Span<byte> pbOutput, int cbOutput, int dwFlags) 1877global::Interop.BCrypt.NTSTATUS __retVal = default; 1902static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hHash_native, byte* __pbOutput_native, int __cbOutput_native, int __dwFlags_native); 1911internal static unsafe partial global::Interop.BCrypt.NTSTATUS BCryptFinishHash(global::Microsoft.Win32.SafeHandles.SafeBCryptHashHandle hHash, byte* pbOutput, int cbOutput, int dwFlags) 1914global::Interop.BCrypt.NTSTATUS __retVal = default; 1937static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hHash_native, byte* __pbOutput_native, int __cbOutput_native, int __dwFlags_native); 1946internal static unsafe extern partial global::Interop.BCrypt.NTSTATUS BCryptGenRandom(nint hAlgorithm, byte* pbBuffer, int cbBuffer, int dwFlags); 1954private static unsafe partial global::Interop.BCrypt.NTSTATUS BCryptGenerateKeyPair(global::Microsoft.Win32.SafeHandles.SafeBCryptAlgorithmHandle hAlgorithm, out global::Microsoft.Win32.SafeHandles.SafeBCryptKeyHandle phKey, int dwLength, uint dwFlags) 1960global::Interop.BCrypt.NTSTATUS __retVal = default; 1996static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hAlgorithm_native, nint* __phKey_native, int __dwLength_native, uint __dwFlags_native); 2005internal static unsafe partial global::Interop.BCrypt.NTSTATUS BCryptGenerateSymmetricKey(global::Microsoft.Win32.SafeHandles.SafeBCryptAlgorithmHandle hAlgorithm, out global::Microsoft.Win32.SafeHandles.SafeBCryptKeyHandle phKey, nint pbKeyObject, int cbKeyObject, byte* pbSecret, int cbSecret, uint dwFlags) 2011global::Interop.BCrypt.NTSTATUS __retVal = default; 2047static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hAlgorithm_native, nint* __phKey_native, nint __pbKeyObject_native, int __cbKeyObject_native, byte* __pbSecret_native, int __cbSecret_native, uint __dwFlags_native); 2056internal static unsafe partial global::Interop.BCrypt.NTSTATUS BCryptGenerateSymmetricKey(nuint hAlgorithm, out global::Microsoft.Win32.SafeHandles.SafeBCryptKeyHandle phKey, nint pbKeyObject, int cbKeyObject, byte* pbSecret, int cbSecret, uint dwFlags) 2061global::Interop.BCrypt.NTSTATUS __retVal = default; 2089static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nuint __hAlgorithm_native, nint* __phKey_native, nint __pbKeyObject_native, int __cbKeyObject_native, byte* __pbSecret_native, int __cbSecret_native, uint __dwFlags_native); 2098internal static unsafe partial global::Interop.BCrypt.NTSTATUS BCryptGetProperty(global::Microsoft.Win32.SafeHandles.SafeBCryptHandle hObject, string pszProperty, void* pbOutput, int cbOutput, out int pcbResult, int dwFlags) 2102global::Interop.BCrypt.NTSTATUS __retVal = default; 2128static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hObject_native, ushort* __pszProperty_native, void* __pbOutput_native, int __cbOutput_native, int* __pcbResult_native, int __dwFlags_native); 2137internal static unsafe extern partial global::Interop.BCrypt.NTSTATUS BCryptHash(nuint hAlgorithm, byte* pbSecret, int cbSecret, byte* pbInput, int cbInput, byte* pbOutput, int cbOutput); 2145internal static partial global::Interop.BCrypt.NTSTATUS BCryptHashData(global::Microsoft.Win32.SafeHandles.SafeBCryptHashHandle hHash, global::System.ReadOnlySpan<byte> pbInput, int cbInput, int dwFlags) 2148global::Interop.BCrypt.NTSTATUS __retVal = default; 2173static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hHash_native, byte* __pbInput_native, int __cbInput_native, int __dwFlags_native); 2182private 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) 2188global::Interop.BCrypt.NTSTATUS __retVal = default; 2226static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hAlgorithm_native, nint __hImportKey_native, ushort* __pszBlobType_native, nint* __hKey_native, nint __pbKeyObject_native, int __cbKeyObject_native, byte* __pbInput_native, int __cbInput_native, int __dwFlags_native); 2235private static unsafe partial global::Interop.BCrypt.NTSTATUS BCryptImportKeyPair(global::Microsoft.Win32.SafeHandles.SafeBCryptAlgorithmHandle hAlgorithm, nint hImportKey, string pszBlobType, out global::Microsoft.Win32.SafeHandles.SafeBCryptKeyHandle phKey, byte* pbInput, int cbInput, uint dwFlags) 2241global::Interop.BCrypt.NTSTATUS __retVal = default; 2279static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hAlgorithm_native, nint __hImportKey_native, ushort* __pszBlobType_native, nint* __phKey_native, byte* __pbInput_native, int __cbInput_native, uint __dwFlags_native); 2288internal static unsafe partial global::Interop.BCrypt.NTSTATUS BCryptKeyDerivation(global::Microsoft.Win32.SafeHandles.SafeBCryptKeyHandle hKey, global::Interop.BCrypt.BCryptBufferDesc* pParameterList, byte* pbDerivedKey, int cbDerivedKey, out uint pcbResult, int dwFlags) 2292global::Interop.BCrypt.NTSTATUS __retVal = default; 2317static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hKey_native, global::Interop.BCrypt.BCryptBufferDesc* __pParameterList_native, byte* __pbDerivedKey_native, int __cbDerivedKey_native, uint* __pcbResult_native, int __dwFlags_native); 2326internal static partial global::Interop.BCrypt.NTSTATUS BCryptOpenAlgorithmProvider(out global::Microsoft.Win32.SafeHandles.SafeBCryptAlgorithmHandle phAlgorithm, string pszAlgId, string pszImplementation, global::Interop.BCrypt.BCryptOpenAlgorithmProviderFlags dwFlags) 2331global::Interop.BCrypt.NTSTATUS __retVal = default; 2362static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint* __phAlgorithm_native, ushort* __pszAlgId_native, ushort* __pszImplementation_native, global::Interop.BCrypt.BCryptOpenAlgorithmProviderFlags __dwFlags_native); 2371private static unsafe partial global::Interop.BCrypt.NTSTATUS BCryptSecretAgreement(global::Microsoft.Win32.SafeHandles.SafeBCryptKeyHandle hPrivKey, global::Microsoft.Win32.SafeHandles.SafeBCryptKeyHandle hPubKey, out global::Microsoft.Win32.SafeHandles.SafeBCryptSecretHandle phAgreedSecret, uint dwFlags) 2378global::Interop.BCrypt.NTSTATUS __retVal = default; 2418static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hPrivKey_native, nint __hPubKey_native, nint* __phAgreedSecret_native, uint __dwFlags_native); 2427internal static unsafe partial global::Interop.BCrypt.NTSTATUS BCryptSetProperty(global::Microsoft.Win32.SafeHandles.SafeBCryptHandle hObject, string pszProperty, void* pbInput, uint cbInput, uint dwFlags) 2430global::Interop.BCrypt.NTSTATUS __retVal = default; 2455static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hObject_native, ushort* __pszProperty_native, void* __pbInput_native, uint __cbInput_native, uint __dwFlags_native); 2464private static unsafe partial global::Interop.BCrypt.NTSTATUS BCryptSignHash(global::Microsoft.Win32.SafeHandles.SafeBCryptKeyHandle hKey, void* pPaddingInfo, byte* pbInput, int cbInput, byte* pbOutput, int cbOutput, out int pcbResult, global::Interop.BCrypt.BCryptSignVerifyFlags dwFlags) 2468global::Interop.BCrypt.NTSTATUS __retVal = default; 2493static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hKey_native, void* __pPaddingInfo_native, byte* __pbInput_native, int __cbInput_native, byte* __pbOutput_native, int __cbOutput_native, int* __pcbResult_native, global::Interop.BCrypt.BCryptSignVerifyFlags __dwFlags_native); 2502private static unsafe partial global::Interop.BCrypt.NTSTATUS BCryptVerifySignature(global::Microsoft.Win32.SafeHandles.SafeBCryptKeyHandle hKey, void* pPaddingInfo, byte* pbHash, int cbHash, byte* pbSignature, int cbSignature, global::Interop.BCrypt.BCryptSignVerifyFlags dwFlags) 2505global::Interop.BCrypt.NTSTATUS __retVal = default; 2528static extern unsafe global::Interop.BCrypt.NTSTATUS __PInvoke(nint __hKey_native, void* __pPaddingInfo_native, byte* __pbHash_native, int __cbHash_native, byte* __pbSignature_native, int __cbSignature_native, global::Interop.BCrypt.BCryptSignVerifyFlags __dwFlags_native); 2537internal static partial bool CertAddCertificateContextToStore(global::Microsoft.Win32.SafeHandles.SafeCertStoreHandle hCertStore, global::Microsoft.Win32.SafeHandles.SafeCertContextHandle pCertContext, global::Interop.Crypt32.CertStoreAddDisposition dwAddDisposition, nint ppStoreContext) 2576static extern unsafe int __PInvoke(nint __hCertStore_native, nint __pCertContext_native, global::Interop.Crypt32.CertStoreAddDisposition __dwAddDisposition_native, nint __ppStoreContext_native); 2585internal static partial bool CertAddCertificateLinkToStore(global::Microsoft.Win32.SafeHandles.SafeCertStoreHandle hCertStore, global::Microsoft.Win32.SafeHandles.SafeCertContextHandle pCertContext, global::Interop.Crypt32.CertStoreAddDisposition dwAddDisposition, nint ppStoreContext) 2624static extern unsafe int __PInvoke(nint __hCertStore_native, nint __pCertContext_native, global::Interop.Crypt32.CertStoreAddDisposition __dwAddDisposition_native, nint __ppStoreContext_native); 2660internal static partial bool CertControlStore(global::Microsoft.Win32.SafeHandles.SafeCertStoreHandle hCertStore, global::Interop.Crypt32.CertControlStoreFlags dwFlags, global::Interop.Crypt32.CertControlStoreType dwControlType, nint pvCtrlPara) 2694static extern unsafe int __PInvoke(nint __hCertStore_native, global::Interop.Crypt32.CertControlStoreFlags __dwFlags_native, global::Interop.Crypt32.CertControlStoreType __dwControlType_native, nint __pvCtrlPara_native); 2703internal static partial bool CertCreateCertificateChainEngine(ref global::Interop.Crypt32.CERT_CHAIN_ENGINE_CONFIG pConfig, out global::Microsoft.Win32.SafeHandles.SafeChainEngineHandle hChainEngineHandle) 2716fixed (global::Interop.Crypt32.CERT_CHAIN_ENGINE_CONFIG* __pConfig_native = &pConfig) 2744static extern unsafe int __PInvoke(global::Interop.Crypt32.CERT_CHAIN_ENGINE_CONFIG* __pConfig_native, nint* __hChainEngineHandle_native); 2753internal static unsafe partial bool CertDeleteCertificateFromStore(global::Interop.Crypt32.CERT_CONTEXT* pCertContext) 2771static extern unsafe int __PInvoke(global::Interop.Crypt32.CERT_CONTEXT* __pCertContext_native); 2960internal static unsafe partial global::Interop.Crypt32.CERT_CONTEXT* CertEnumCertificatesInStore(global::Microsoft.Win32.SafeHandles.SafeCertStoreHandle hCertStore, global::Interop.Crypt32.CERT_CONTEXT* pPrevCertContext) 2964global::Interop.Crypt32.CERT_CONTEXT* __retVal = default; 2990static extern unsafe global::Interop.Crypt32.CERT_CONTEXT* __PInvoke(nint __hCertStore_native, global::Interop.Crypt32.CERT_CONTEXT* __pPrevCertContext_native); 2999internal static unsafe partial global::Microsoft.Win32.SafeHandles.SafeCertContextHandle CertFindCertificateInStore(global::Microsoft.Win32.SafeHandles.SafeCertStoreHandle hCertStore, global::Interop.Crypt32.CertEncodingType dwCertEncodingType, global::Interop.Crypt32.CertFindFlags dwFindFlags, global::Interop.Crypt32.CertFindType dwFindType, void* pvFindPara, global::Interop.Crypt32.CERT_CONTEXT* pPrevCertContext) 3044static extern unsafe nint __PInvoke(nint __hCertStore_native, global::Interop.Crypt32.CertEncodingType __dwCertEncodingType_native, global::Interop.Crypt32.CertFindFlags __dwFindFlags_native, global::Interop.Crypt32.CertFindType __dwFindType_native, void* __pvFindPara_native, global::Interop.Crypt32.CERT_CONTEXT* __pPrevCertContext_native); 3053internal static unsafe partial global::Interop.Crypt32.CERT_EXTENSION* CertFindExtension(string pszObjId, int cExtensions, nint rgExtensions) 3057global::Interop.Crypt32.CERT_EXTENSION* __retVal = default; 3083static extern unsafe global::Interop.Crypt32.CERT_EXTENSION* __PInvoke(byte* __pszObjId_native, int __cExtensions_native, nint __rgExtensions_native); 3122internal static unsafe partial bool CertGetCertificateChain(nint hChainEngine, global::Microsoft.Win32.SafeHandles.SafeCertContextHandle pCertContext, global::Interop.Crypt32.FILETIME* pTime, global::Microsoft.Win32.SafeHandles.SafeCertStoreHandle hStore, ref global::Interop.Crypt32.CERT_CHAIN_PARA pChainPara, global::Interop.Crypt32.CertChainFlags dwFlags, nint pvReserved, out global::Microsoft.Win32.SafeHandles.SafeX509ChainHandle ppChainContext) 3142fixed (global::Interop.Crypt32.CERT_CHAIN_PARA* __pChainPara_native = &pChainPara) 3177static extern unsafe int __PInvoke(nint __hChainEngine_native, nint __pCertContext_native, global::Interop.Crypt32.FILETIME* __pTime_native, nint __hStore_native, global::Interop.Crypt32.CERT_CHAIN_PARA* __pChainPara_native, global::Interop.Crypt32.CertChainFlags __dwFlags_native, nint __pvReserved_native, nint* __ppChainContext_native); 3186internal static partial bool CertGetCertificateContextProperty(global::Microsoft.Win32.SafeHandles.SafeCertContextHandle pCertContext, global::Interop.Crypt32.CertContextPropId dwPropId, byte[] pvData, ref int pcbData) 3223static extern unsafe int __PInvoke(nint __pCertContext_native, global::Interop.Crypt32.CertContextPropId __dwPropId_native, byte* __pvData_native, int* __pcbData_native); 3232internal static unsafe partial bool CertGetCertificateContextPropertyPtr(global::Microsoft.Win32.SafeHandles.SafeCertContextHandle pCertContext, global::Interop.Crypt32.CertContextPropId dwPropId, byte* pvData, ref int pcbData) 3268static extern unsafe int __PInvoke(nint __pCertContext_native, global::Interop.Crypt32.CertContextPropId __dwPropId_native, byte* __pvData_native, int* __pcbData_native); 3277internal static partial bool CertGetCertificateContextProperty(global::Microsoft.Win32.SafeHandles.SafeCertContextHandle pCertContext, global::Interop.Crypt32.CertContextPropId dwPropId, out nint pvData, ref int pcbData) 3315static extern unsafe int __PInvoke(nint __pCertContext_native, global::Interop.Crypt32.CertContextPropId __dwPropId_native, nint* __pvData_native, int* __pcbData_native); 3324internal static partial bool CertGetCertificateContextProperty(global::Microsoft.Win32.SafeHandles.SafeCertContextHandle pCertContext, global::Interop.Crypt32.CertContextPropId dwPropId, out global::Interop.Crypt32.DATA_BLOB pvData, ref int pcbData) 3339fixed (global::Interop.Crypt32.DATA_BLOB* __pvData_native = &pvData) 3362static extern unsafe int __PInvoke(nint __pCertContext_native, global::Interop.Crypt32.CertContextPropId __dwPropId_native, global::Interop.Crypt32.DATA_BLOB* __pvData_native, int* __pcbData_native); 3371internal static unsafe partial bool CertGetCertificateContextPropertyString(global::Microsoft.Win32.SafeHandles.SafeCertContextHandle pCertContext, global::Interop.Crypt32.CertContextPropId dwPropId, byte* pvData, ref uint pcbData) 3407static extern unsafe int __PInvoke(nint __pCertContext_native, global::Interop.Crypt32.CertContextPropId __dwPropId_native, byte* __pvData_native, uint* __pcbData_native); 3416internal static unsafe partial bool CertGetIntendedKeyUsage(global::Interop.Crypt32.CertEncodingType dwCertEncodingType, global::Interop.Crypt32.CERT_INFO* pCertInfo, out global::Interop.Crypt32.X509KeyUsageFlags pbKeyUsage, int cbKeyUsage) 3423fixed (global::Interop.Crypt32.X509KeyUsageFlags* __pbKeyUsage_native = &pbKeyUsage) 3437static extern unsafe int __PInvoke(global::Interop.Crypt32.CertEncodingType __dwCertEncodingType_native, global::Interop.Crypt32.CERT_INFO* __pCertInfo_native, global::Interop.Crypt32.X509KeyUsageFlags* __pbKeyUsage_native, int __cbKeyUsage_native); 3446internal static unsafe partial int CertGetNameString(global::Microsoft.Win32.SafeHandles.SafeCertContextHandle pCertContext, global::Interop.Crypt32.CertNameType dwType, global::Interop.Crypt32.CertNameFlags dwFlags, in global::Interop.Crypt32.CertNameStringType pvTypePara, char* pszNameString, int cchNameString) 3458fixed (global::Interop.Crypt32.CertNameStringType* __pvTypePara_native = &pvTypePara) 3478static extern unsafe int __PInvoke(nint __pCertContext_native, global::Interop.Crypt32.CertNameType __dwType_native, global::Interop.Crypt32.CertNameFlags __dwFlags_native, global::Interop.Crypt32.CertNameStringType* __pvTypePara_native, char* __pszNameString_native, int __cchNameString_native); 3573internal static partial bool CertVerifyCertificateChainPolicy(nint pszPolicyOID, global::Microsoft.Win32.SafeHandles.SafeX509ChainHandle pChainContext, ref global::Interop.Crypt32.CERT_CHAIN_POLICY_PARA pPolicyPara, ref global::Interop.Crypt32.CERT_CHAIN_POLICY_STATUS pPolicyStatus) 3586fixed (global::Interop.Crypt32.CERT_CHAIN_POLICY_STATUS* __pPolicyStatus_native = &pPolicyStatus) 3587fixed (global::Interop.Crypt32.CERT_CHAIN_POLICY_PARA* __pPolicyPara_native = &pPolicyPara) 3610static extern unsafe int __PInvoke(nint __pszPolicyOID_native, nint __pChainContext_native, global::Interop.Crypt32.CERT_CHAIN_POLICY_PARA* __pPolicyPara_native, global::Interop.Crypt32.CERT_CHAIN_POLICY_STATUS* __pPolicyStatus_native); 3643internal static partial global::Microsoft.Win32.SafeHandles.SafeCertStoreHandle CertOpenStore(nint lpszStoreProvider, global::Interop.Crypt32.CertEncodingType dwMsgAndCertEncodingType, nint hCryptProv, global::Interop.Crypt32.CertStoreFlags dwFlags, string pvPara) 3681static extern unsafe nint __PInvoke(nint __lpszStoreProvider_native, global::Interop.Crypt32.CertEncodingType __dwMsgAndCertEncodingType_native, nint __hCryptProv_native, global::Interop.Crypt32.CertStoreFlags __dwFlags_native, ushort* __pvPara_native); 3690public static partial bool CertSaveStore(global::Microsoft.Win32.SafeHandles.SafeCertStoreHandle hCertStore, global::Interop.Crypt32.CertEncodingType dwMsgAndCertEncodingType, global::Interop.Crypt32.CertStoreSaveAs dwSaveAs, global::Interop.Crypt32.CertStoreSaveTo dwSaveTo, ref global::Interop.Crypt32.DATA_BLOB pvSaveToPara, int dwFlags) 3703fixed (global::Interop.Crypt32.DATA_BLOB* __pvSaveToPara_native = &pvSaveToPara) 3726static extern unsafe int __PInvoke(nint __hCertStore_native, global::Interop.Crypt32.CertEncodingType __dwMsgAndCertEncodingType_native, global::Interop.Crypt32.CertStoreSaveAs __dwSaveAs_native, global::Interop.Crypt32.CertStoreSaveTo __dwSaveTo_native, global::Interop.Crypt32.DATA_BLOB* __pvSaveToPara_native, int __dwFlags_native); 3781internal static unsafe partial bool CertSetCertificateContextProperty(global::Microsoft.Win32.SafeHandles.SafeCertContextHandle pCertContext, global::Interop.Crypt32.CertContextPropId dwPropId, global::Interop.Crypt32.CertSetPropertyFlags dwFlags, global::Interop.Crypt32.CRYPT_KEY_PROV_INFO* pvData) 3815static extern unsafe int __PInvoke(nint __pCertContext_native, global::Interop.Crypt32.CertContextPropId __dwPropId_native, global::Interop.Crypt32.CertSetPropertyFlags __dwFlags_native, global::Interop.Crypt32.CRYPT_KEY_PROV_INFO* __pvData_native); 3824internal static unsafe partial bool CertSetCertificateContextProperty(nint pCertContext, global::Interop.Crypt32.CertContextPropId dwPropId, global::Interop.Crypt32.CertSetPropertyFlags dwFlags, global::Interop.Crypt32.CRYPT_KEY_PROV_INFO* pvData) 3842static extern unsafe int __PInvoke(nint __pCertContext_native, global::Interop.Crypt32.CertContextPropId __dwPropId_native, global::Interop.Crypt32.CertSetPropertyFlags __dwFlags_native, global::Interop.Crypt32.CRYPT_KEY_PROV_INFO* __pvData_native); 3851internal static unsafe partial bool CertSetCertificateContextProperty(global::Microsoft.Win32.SafeHandles.SafeCertContextHandle pCertContext, global::Interop.Crypt32.CertContextPropId dwPropId, global::Interop.Crypt32.CertSetPropertyFlags dwFlags, global::Interop.Crypt32.DATA_BLOB* pvData) 3885static extern unsafe int __PInvoke(nint __pCertContext_native, global::Interop.Crypt32.CertContextPropId __dwPropId_native, global::Interop.Crypt32.CertSetPropertyFlags __dwFlags_native, global::Interop.Crypt32.DATA_BLOB* __pvData_native); 3894internal static unsafe partial bool CertSetCertificateContextProperty(global::Microsoft.Win32.SafeHandles.SafeCertContextHandle pCertContext, global::Interop.Crypt32.CertContextPropId dwPropId, global::Interop.Crypt32.CertSetPropertyFlags dwFlags, global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle keyHandle) 3933static extern unsafe int __PInvoke(nint __pCertContext_native, global::Interop.Crypt32.CertContextPropId __dwPropId_native, global::Interop.Crypt32.CertSetPropertyFlags __dwFlags_native, nint __keyHandle_native); 3942internal static unsafe partial bool CertSetCertificateContextProperty(nint pCertContext, global::Interop.Crypt32.CertContextPropId dwPropId, global::Interop.Crypt32.CertSetPropertyFlags dwFlags, global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle keyHandle) 3976static extern unsafe int __PInvoke(nint __pCertContext_native, global::Interop.Crypt32.CertContextPropId __dwPropId_native, global::Interop.Crypt32.CertSetPropertyFlags __dwFlags_native, nint __keyHandle_native); 3985internal static partial bool CertStrToName(global::Interop.Crypt32.CertEncodingType dwCertEncodingType, string pszX500, global::Interop.Crypt32.CertNameStrTypeAndFlags dwStrType, nint pvReserved, byte[] pbEncoded, ref int pcbEncoded, nint ppszError) 4007static extern unsafe int __PInvoke(global::Interop.Crypt32.CertEncodingType __dwCertEncodingType_native, ushort* __pszX500_native, global::Interop.Crypt32.CertNameStrTypeAndFlags __dwStrType_native, nint __pvReserved_native, byte* __pbEncoded_native, int* __pcbEncoded_native, nint __ppszError_native); 4016internal static unsafe partial int CertVerifyTimeValidity(ref global::Interop.Crypt32.FILETIME pTimeToVerify, global::Interop.Crypt32.CERT_INFO* pCertInfo) 4021fixed (global::Interop.Crypt32.FILETIME* __pTimeToVerify_native = &pTimeToVerify) 4033static extern unsafe int __PInvoke(global::Interop.Crypt32.FILETIME* __pTimeToVerify_native, global::Interop.Crypt32.CERT_INFO* __pCertInfo_native); 4042public static partial bool CryptAcquireCertificatePrivateKey(global::Microsoft.Win32.SafeHandles.SafeCertContextHandle pCert, global::Interop.Crypt32.CryptAcquireCertificatePrivateKeyFlags dwFlags, nint pvParameters, out global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle phCryptProvOrNCryptKey, out global::Interop.Crypt32.CryptKeySpec pdwKeySpec, out bool pfCallerFreeProvOrNCryptKey) 4062fixed (global::Interop.Crypt32.CryptKeySpec* __pdwKeySpec_native = &pdwKeySpec) 4096static extern unsafe int __PInvoke(nint __pCert_native, global::Interop.Crypt32.CryptAcquireCertificatePrivateKeyFlags __dwFlags_native, nint __pvParameters_native, nint* __phCryptProvOrNCryptKey_native, global::Interop.Crypt32.CryptKeySpec* __pdwKeySpec_native, int* __pfCallerFreeProvOrNCryptKey_native); 4105internal static partial bool CryptDecodeObject(global::Interop.Crypt32.CertEncodingType dwCertEncodingType, nint lpszStructType, byte[] pbEncoded, int cbEncoded, global::Interop.Crypt32.CryptDecodeObjectFlags dwFlags, byte[] pvStructInfo, ref int pcbStructInfo) 4127static extern unsafe int __PInvoke(global::Interop.Crypt32.CertEncodingType __dwCertEncodingType_native, nint __lpszStructType_native, byte* __pbEncoded_native, int __cbEncoded_native, global::Interop.Crypt32.CryptDecodeObjectFlags __dwFlags_native, byte* __pvStructInfo_native, int* __pcbStructInfo_native); 4136internal static unsafe partial bool CryptDecodeObjectPointer(global::Interop.Crypt32.CertEncodingType dwCertEncodingType, nint lpszStructType, byte[] pbEncoded, int cbEncoded, global::Interop.Crypt32.CryptDecodeObjectFlags dwFlags, void* pvStructInfo, ref int pcbStructInfo) 4157static extern unsafe int __PInvoke(global::Interop.Crypt32.CertEncodingType __dwCertEncodingType_native, nint __lpszStructType_native, byte* __pbEncoded_native, int __cbEncoded_native, global::Interop.Crypt32.CryptDecodeObjectFlags __dwFlags_native, void* __pvStructInfo_native, int* __pcbStructInfo_native); 4166internal static unsafe partial bool CryptDecodeObjectPointer(global::Interop.Crypt32.CertEncodingType dwCertEncodingType, nint lpszStructType, byte* pbEncoded, int cbEncoded, global::Interop.Crypt32.CryptDecodeObjectFlags dwFlags, void* pvStructInfo, ref int pcbStructInfo) 4186static extern unsafe int __PInvoke(global::Interop.Crypt32.CertEncodingType __dwCertEncodingType_native, nint __lpszStructType_native, byte* __pbEncoded_native, int __cbEncoded_native, global::Interop.Crypt32.CryptDecodeObjectFlags __dwFlags_native, void* __pvStructInfo_native, int* __pcbStructInfo_native); 4195internal static unsafe partial bool CryptDecodeObjectPointer(global::Interop.Crypt32.CertEncodingType dwCertEncodingType, string lpszStructType, byte[] pbEncoded, int cbEncoded, global::Interop.Crypt32.CryptDecodeObjectFlags dwFlags, void* pvStructInfo, ref int pcbStructInfo) 4232static extern unsafe int __PInvoke(global::Interop.Crypt32.CertEncodingType __dwCertEncodingType_native, byte* __lpszStructType_native, byte* __pbEncoded_native, int __cbEncoded_native, global::Interop.Crypt32.CryptDecodeObjectFlags __dwFlags_native, void* __pvStructInfo_native, int* __pcbStructInfo_native); 4241internal static unsafe partial bool CryptEncodeObject(global::Interop.Crypt32.CertEncodingType dwCertEncodingType, nint lpszStructType, void* pvStructInfo, byte[] pbEncoded, ref int pcbEncoded) 4262static extern unsafe int __PInvoke(global::Interop.Crypt32.CertEncodingType __dwCertEncodingType_native, nint __lpszStructType_native, void* __pvStructInfo_native, byte* __pbEncoded_native, int* __pcbEncoded_native); 4271internal static unsafe partial bool CryptEncodeObject(global::Interop.Crypt32.CertEncodingType dwCertEncodingType, string lpszStructType, void* pvStructInfo, byte[] pbEncoded, ref int pcbEncoded) 4308static extern unsafe int __PInvoke(global::Interop.Crypt32.CertEncodingType __dwCertEncodingType_native, byte* __lpszStructType_native, void* __pvStructInfo_native, byte* __pbEncoded_native, int* __pcbEncoded_native); 4347internal static unsafe partial bool CryptImportPublicKeyInfoEx2(global::Interop.Crypt32.CertEncodingType dwCertEncodingType, global::Interop.Crypt32.CERT_PUBLIC_KEY_INFO* pInfo, global::Interop.Crypt32.CryptImportPublicKeyInfoFlags dwFlags, void* pvAuxInfo, out global::Microsoft.Win32.SafeHandles.SafeBCryptKeyHandle phKey) 4386static extern unsafe int __PInvoke(global::Interop.Crypt32.CertEncodingType __dwCertEncodingType_native, global::Interop.Crypt32.CERT_PUBLIC_KEY_INFO* __pInfo_native, global::Interop.Crypt32.CryptImportPublicKeyInfoFlags __dwFlags_native, void* __pvAuxInfo_native, nint* __phKey_native); 4422internal static partial bool CryptMsgGetParam(global::Microsoft.Win32.SafeHandles.SafeCryptMsgHandle hCryptMsg, global::Interop.Crypt32.CryptMsgParamType dwParamType, int dwIndex, out int pvData, ref int pcbData) 4460static extern unsafe int __PInvoke(nint __hCryptMsg_native, global::Interop.Crypt32.CryptMsgParamType __dwParamType_native, int __dwIndex_native, int* __pvData_native, int* __pcbData_native); 4469internal static unsafe partial bool CryptMsgGetParam(global::Microsoft.Win32.SafeHandles.SafeCryptMsgHandle hCryptMsg, global::Interop.Crypt32.CryptMsgParamType dwParamType, int dwIndex, byte* pvData, ref int pcbData) 4505static extern unsafe int __PInvoke(nint __hCryptMsg_native, global::Interop.Crypt32.CryptMsgParamType __dwParamType_native, int __dwIndex_native, byte* __pvData_native, int* __pcbData_native); 4514internal static partial bool CryptMsgGetParam(global::Microsoft.Win32.SafeHandles.SafeCryptMsgHandle hCryptMsg, global::Interop.Crypt32.CryptMsgParamType dwParamType, int dwIndex, out global::Interop.Crypt32.CryptMsgType pvData, ref int pcbData) 4529fixed (global::Interop.Crypt32.CryptMsgType* __pvData_native = &pvData) 4552static extern unsafe int __PInvoke(nint __hCryptMsg_native, global::Interop.Crypt32.CryptMsgParamType __dwParamType_native, int __dwIndex_native, global::Interop.Crypt32.CryptMsgType* __pvData_native, int* __pcbData_native); 4561internal static partial bool CryptMsgGetParam(global::Microsoft.Win32.SafeHandles.SafeCryptMsgHandle hCryptMsg, global::Interop.Crypt32.CryptMsgParamType dwParamType, int dwIndex, nint pvData, ref int pcbData) 4597static extern unsafe int __PInvoke(nint __hCryptMsg_native, global::Interop.Crypt32.CryptMsgParamType __dwParamType_native, int __dwIndex_native, nint __pvData_native, int* __pcbData_native); 4606internal static unsafe partial bool CryptQueryObject(global::Interop.Crypt32.CertQueryObjectType dwObjectType, void* pvObject, global::Interop.Crypt32.ExpectedContentTypeFlags dwExpectedContentTypeFlags, global::Interop.Crypt32.ExpectedFormatTypeFlags dwExpectedFormatTypeFlags, int dwFlags, out global::Interop.Crypt32.CertEncodingType pdwMsgAndCertEncodingType, out global::Interop.Crypt32.ContentType pdwContentType, out global::Interop.Crypt32.FormatType pdwFormatType, out global::Microsoft.Win32.SafeHandles.SafeCertStoreHandle phCertStore, out global::Microsoft.Win32.SafeHandles.SafeCryptMsgHandle phMsg, out global::Microsoft.Win32.SafeHandles.SafeCertContextHandle ppvContext) 4628fixed (global::Interop.Crypt32.FormatType* __pdwFormatType_native = &pdwFormatType) 4629fixed (global::Interop.Crypt32.ContentType* __pdwContentType_native = &pdwContentType) 4630fixed (global::Interop.Crypt32.CertEncodingType* __pdwMsgAndCertEncodingType_native = &pdwMsgAndCertEncodingType) 4664static extern unsafe int __PInvoke(global::Interop.Crypt32.CertQueryObjectType __dwObjectType_native, void* __pvObject_native, global::Interop.Crypt32.ExpectedContentTypeFlags __dwExpectedContentTypeFlags_native, global::Interop.Crypt32.ExpectedFormatTypeFlags __dwExpectedFormatTypeFlags_native, int __dwFlags_native, global::Interop.Crypt32.CertEncodingType* __pdwMsgAndCertEncodingType_native, global::Interop.Crypt32.ContentType* __pdwContentType_native, global::Interop.Crypt32.FormatType* __pdwFormatType_native, nint* __phCertStore_native, nint* __phMsg_native, nint* __ppvContext_native); 4673internal static unsafe partial bool CryptQueryObject(global::Interop.Crypt32.CertQueryObjectType dwObjectType, void* pvObject, global::Interop.Crypt32.ExpectedContentTypeFlags dwExpectedContentTypeFlags, global::Interop.Crypt32.ExpectedFormatTypeFlags dwExpectedFormatTypeFlags, int dwFlags, nint pdwMsgAndCertEncodingType, out global::Interop.Crypt32.ContentType pdwContentType, nint pdwFormatType, nint phCertStore, nint phMsg, nint ppvContext) 4680fixed (global::Interop.Crypt32.ContentType* __pdwContentType_native = &pdwContentType) 4694static extern unsafe int __PInvoke(global::Interop.Crypt32.CertQueryObjectType __dwObjectType_native, void* __pvObject_native, global::Interop.Crypt32.ExpectedContentTypeFlags __dwExpectedContentTypeFlags_native, global::Interop.Crypt32.ExpectedFormatTypeFlags __dwExpectedFormatTypeFlags_native, int __dwFlags_native, nint __pdwMsgAndCertEncodingType_native, global::Interop.Crypt32.ContentType* __pdwContentType_native, nint __pdwFormatType_native, nint __phCertStore_native, nint __phMsg_native, nint __ppvContext_native); 4703internal static unsafe partial bool CryptQueryObject(global::Interop.Crypt32.CertQueryObjectType dwObjectType, void* pvObject, global::Interop.Crypt32.ExpectedContentTypeFlags dwExpectedContentTypeFlags, global::Interop.Crypt32.ExpectedFormatTypeFlags dwExpectedFormatTypeFlags, int dwFlags, nint pdwMsgAndCertEncodingType, out global::Interop.Crypt32.ContentType pdwContentType, nint pdwFormatType, out global::Microsoft.Win32.SafeHandles.SafeCertStoreHandle phCertStore, nint phMsg, nint ppvContext) 4717fixed (global::Interop.Crypt32.ContentType* __pdwContentType_native = &pdwContentType) 4745static extern unsafe int __PInvoke(global::Interop.Crypt32.CertQueryObjectType __dwObjectType_native, void* __pvObject_native, global::Interop.Crypt32.ExpectedContentTypeFlags __dwExpectedContentTypeFlags_native, global::Interop.Crypt32.ExpectedFormatTypeFlags __dwExpectedFormatTypeFlags_native, int __dwFlags_native, nint __pdwMsgAndCertEncodingType_native, global::Interop.Crypt32.ContentType* __pdwContentType_native, nint __pdwFormatType_native, nint* __phCertStore_native, nint __phMsg_native, nint __ppvContext_native); 4754internal static unsafe partial bool CryptQueryObject(global::Interop.Crypt32.CertQueryObjectType dwObjectType, void* pvObject, global::Interop.Crypt32.ExpectedContentTypeFlags dwExpectedContentTypeFlags, global::Interop.Crypt32.ExpectedFormatTypeFlags dwExpectedFormatTypeFlags, int dwFlags, nint pdwMsgAndCertEncodingType, out global::Interop.Crypt32.ContentType pdwContentType, nint pdwFormatType, nint phCertStore, nint phMsg, out global::Microsoft.Win32.SafeHandles.SafeCertContextHandle ppvContext) 4768fixed (global::Interop.Crypt32.ContentType* __pdwContentType_native = &pdwContentType) 4796static extern unsafe int __PInvoke(global::Interop.Crypt32.CertQueryObjectType __dwObjectType_native, void* __pvObject_native, global::Interop.Crypt32.ExpectedContentTypeFlags __dwExpectedContentTypeFlags_native, global::Interop.Crypt32.ExpectedFormatTypeFlags __dwExpectedFormatTypeFlags_native, int __dwFlags_native, nint __pdwMsgAndCertEncodingType_native, global::Interop.Crypt32.ContentType* __pdwContentType_native, nint __pdwFormatType_native, nint __phCertStore_native, nint __phMsg_native, nint* __ppvContext_native); 4805private static unsafe extern partial global::Interop.Crypt32.CRYPT_OID_INFO* CryptFindOIDInfo(global::Interop.Crypt32.CryptOidInfoKeyType dwKeyType, nint pvKey, global::System.Security.Cryptography.OidGroup group); 4813private static unsafe extern partial global::Interop.Crypt32.CRYPT_OID_INFO* CryptFindOIDInfo(global::Interop.Crypt32.CryptOidInfoKeyType dwKeyType, void* pvKey, global::System.Security.Cryptography.OidGroup group); 4821internal static unsafe partial bool PFXExportCertStoreEx(global::Microsoft.Win32.SafeHandles.SafeCertStoreHandle hStore, ref global::Interop.Crypt32.DATA_BLOB pPFX, global::Microsoft.Win32.SafeHandles.SafePasswordHandle szPassword, global::Interop.Crypt32.PKCS12_PBES2_EXPORT_PARAMS* pvPara, global::Interop.Crypt32.PFXExportFlags dwFlags) 4837fixed (global::Interop.Crypt32.DATA_BLOB* __pPFX_native = &pPFX) 4862static extern unsafe int __PInvoke(nint __hStore_native, global::Interop.Crypt32.DATA_BLOB* __pPFX_native, nint __szPassword_native, global::Interop.Crypt32.PKCS12_PBES2_EXPORT_PARAMS* __pvPara_native, global::Interop.Crypt32.PFXExportFlags __dwFlags_native); 4871internal static partial global::Microsoft.Win32.SafeHandles.SafeCertStoreHandle PFXImportCertStore(ref global::Interop.Crypt32.DATA_BLOB pPFX, global::Microsoft.Win32.SafeHandles.SafePasswordHandle password, global::Interop.Crypt32.PfxCertStoreFlags dwFlags) 4886fixed (global::Interop.Crypt32.DATA_BLOB* __pPFX_native = &pPFX) 4918static extern unsafe nint __PInvoke(global::Interop.Crypt32.DATA_BLOB* __pPFX_native, nint __password_native, global::Interop.Crypt32.PfxCertStoreFlags __dwFlags_native); 4927internal static unsafe partial global::Microsoft.Win32.SafeHandles.SafeCertStoreHandle PFXImportCertStore(ref global::Interop.Crypt32.DATA_BLOB pPFX, char* password, global::Interop.Crypt32.PfxCertStoreFlags dwFlags) 4938fixed (global::Interop.Crypt32.DATA_BLOB* __pPFX_native = &pPFX) 4965static extern unsafe nint __PInvoke(global::Interop.Crypt32.DATA_BLOB* __pPFX_native, char* __password_native, global::Interop.Crypt32.PfxCertStoreFlags __dwFlags_native); 4998internal static unsafe partial global::Interop.NCrypt.ErrorCode NCryptEncrypt(global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle hKey, global::System.ReadOnlySpan<byte> pbInput, int cbInput, void* pPaddingInfo, global::System.Span<byte> pbOutput, int cbOutput, out int pcbResult, global::Interop.NCrypt.AsymmetricPaddingMode dwFlags) 5002global::Interop.NCrypt.ErrorCode __retVal = default; 5029static extern unsafe global::Interop.NCrypt.ErrorCode __PInvoke(nint __hKey_native, byte* __pbInput_native, int __cbInput_native, void* __pPaddingInfo_native, byte* __pbOutput_native, int __cbOutput_native, int* __pcbResult_native, global::Interop.NCrypt.AsymmetricPaddingMode __dwFlags_native); 5038internal static unsafe partial global::Interop.NCrypt.ErrorCode NCryptDecrypt(global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle hKey, global::System.ReadOnlySpan<byte> pbInput, int cbInput, void* pPaddingInfo, global::System.Span<byte> pbOutput, int cbOutput, out int pcbResult, global::Interop.NCrypt.AsymmetricPaddingMode dwFlags) 5042global::Interop.NCrypt.ErrorCode __retVal = default; 5069static extern unsafe global::Interop.NCrypt.ErrorCode __PInvoke(nint __hKey_native, byte* __pbInput_native, int __cbInput_native, void* __pPaddingInfo_native, byte* __pbOutput_native, int __cbOutput_native, int* __pcbResult_native, global::Interop.NCrypt.AsymmetricPaddingMode __dwFlags_native); 5078internal static partial global::Interop.NCrypt.ErrorCode NCryptOpenKey(global::Microsoft.Win32.SafeHandles.SafeNCryptProviderHandle hProvider, out global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle phKey, string pszKeyName, int dwLegacyKeySpec, global::System.Security.Cryptography.CngKeyOpenOptions dwFlags) 5084global::Interop.NCrypt.ErrorCode __retVal = default; 5122static extern unsafe global::Interop.NCrypt.ErrorCode __PInvoke(nint __hProvider_native, nint* __phKey_native, ushort* __pszKeyName_native, int __dwLegacyKeySpec_native, global::System.Security.Cryptography.CngKeyOpenOptions __dwFlags_native); 5131internal static partial global::Interop.NCrypt.ErrorCode NCryptImportKey(global::Microsoft.Win32.SafeHandles.SafeNCryptProviderHandle hProvider, nint hImportKey, string pszBlobType, nint pParameterList, out global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle phKey, ref byte pbData, int cbData, int dwFlags) 5137global::Interop.NCrypt.ErrorCode __retVal = default; 5176static extern unsafe global::Interop.NCrypt.ErrorCode __PInvoke(nint __hProvider_native, nint __hImportKey_native, ushort* __pszBlobType_native, nint __pParameterList_native, nint* __phKey_native, byte* __pbData_native, int __cbData_native, int __dwFlags_native); 5185internal static partial global::Interop.NCrypt.ErrorCode NCryptImportKey(global::Microsoft.Win32.SafeHandles.SafeNCryptProviderHandle hProvider, nint hImportKey, string pszBlobType, ref global::Interop.NCrypt.NCryptBufferDesc pParameterList, out global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle phKey, ref byte pbData, int cbData, int dwFlags) 5191global::Interop.NCrypt.ErrorCode __retVal = default; 5201fixed (global::Interop.NCrypt.NCryptBufferDesc* __pParameterList_native = &pParameterList) 5231static extern unsafe global::Interop.NCrypt.ErrorCode __PInvoke(nint __hProvider_native, nint __hImportKey_native, ushort* __pszBlobType_native, global::Interop.NCrypt.NCryptBufferDesc* __pParameterList_native, nint* __phKey_native, byte* __pbData_native, int __cbData_native, int __dwFlags_native); 5240internal static partial global::Interop.NCrypt.ErrorCode NCryptExportKey(global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle hKey, nint hExportKey, string pszBlobType, nint pParameterList, byte[] pbOutput, int cbOutput, out int pcbResult, int dwFlags) 5244global::Interop.NCrypt.ErrorCode __retVal = default; 5271static extern unsafe global::Interop.NCrypt.ErrorCode __PInvoke(nint __hKey_native, nint __hExportKey_native, ushort* __pszBlobType_native, nint __pParameterList_native, byte* __pbOutput_native, int __cbOutput_native, int* __pcbResult_native, int __dwFlags_native); 5280internal static partial global::Interop.NCrypt.ErrorCode NCryptExportKey(global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle hKey, nint hExportKey, string pszBlobType, nint pParameterList, ref byte pbOutput, int cbOutput, out int pcbResult, int dwFlags) 5284global::Interop.NCrypt.ErrorCode __retVal = default; 5311static extern unsafe global::Interop.NCrypt.ErrorCode __PInvoke(nint __hKey_native, nint __hExportKey_native, ushort* __pszBlobType_native, nint __pParameterList_native, byte* __pbOutput_native, int __cbOutput_native, int* __pcbResult_native, int __dwFlags_native); 5320private static unsafe partial global::Interop.NCrypt.ErrorCode NCryptExportKey(global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle hKey, nint hExportKey, string pszBlobType, nint pParameterList, byte* pbOutput, int cbOutput, out int pcbResult, int dwFlags) 5324global::Interop.NCrypt.ErrorCode __retVal = default; 5350static extern unsafe global::Interop.NCrypt.ErrorCode __PInvoke(nint __hKey_native, nint __hExportKey_native, ushort* __pszBlobType_native, nint __pParameterList_native, byte* __pbOutput_native, int __cbOutput_native, int* __pcbResult_native, int __dwFlags_native); 5359internal static partial global::Interop.NCrypt.ErrorCode NCryptExportKey(global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle hKey, nint hExportKey, string pszBlobType, ref global::Interop.NCrypt.NCryptBufferDesc pParameterList, ref byte pbOutput, int cbOutput, out int pcbResult, int dwFlags) 5363global::Interop.NCrypt.ErrorCode __retVal = default; 5373fixed (global::Interop.NCrypt.NCryptBufferDesc* __pParameterList_native = &pParameterList) 5391static extern unsafe global::Interop.NCrypt.ErrorCode __PInvoke(nint __hKey_native, nint __hExportKey_native, ushort* __pszBlobType_native, global::Interop.NCrypt.NCryptBufferDesc* __pParameterList_native, byte* __pbOutput_native, int __cbOutput_native, int* __pcbResult_native, int __dwFlags_native); 5400internal static partial global::Interop.NCrypt.ErrorCode NCryptDeleteKey(global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle hKey, int dwFlags) 5403global::Interop.NCrypt.ErrorCode __retVal = default; 5426static extern unsafe global::Interop.NCrypt.ErrorCode __PInvoke(nint __hKey_native, int __dwFlags_native); 5435internal static partial global::Interop.NCrypt.ErrorCode NCryptCreatePersistedKey(global::Microsoft.Win32.SafeHandles.SafeNCryptProviderHandle hProvider, out global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle phKey, string pszAlgId, string pszKeyName, int dwLegacyKeySpec, global::System.Security.Cryptography.CngKeyCreationOptions dwFlags) 5441global::Interop.NCrypt.ErrorCode __retVal = default; 5480static extern unsafe global::Interop.NCrypt.ErrorCode __PInvoke(nint __hProvider_native, nint* __phKey_native, ushort* __pszAlgId_native, ushort* __pszKeyName_native, int __dwLegacyKeySpec_native, global::System.Security.Cryptography.CngKeyCreationOptions __dwFlags_native); 5489internal static partial global::Interop.NCrypt.ErrorCode NCryptFinalizeKey(global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle hKey, int dwFlags) 5492global::Interop.NCrypt.ErrorCode __retVal = default; 5515static extern unsafe global::Interop.NCrypt.ErrorCode __PInvoke(nint __hKey_native, int __dwFlags_native); 5524private static unsafe partial global::Interop.NCrypt.ErrorCode NCryptDecapsulate(global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle hKey, byte* pbCipherText, uint cbCipherText, byte* pbSecretKey, uint cbSecretKey, out uint pcbSecretKey, uint dwFlags) 5528global::Interop.NCrypt.ErrorCode __retVal = default; 5553static extern unsafe global::Interop.NCrypt.ErrorCode __PInvoke(nint __hKey_native, byte* __pbCipherText_native, uint __cbCipherText_native, byte* __pbSecretKey_native, uint __cbSecretKey_native, uint* __pcbSecretKey_native, uint __dwFlags_native); 5562private static unsafe partial global::Interop.NCrypt.ErrorCode NCryptEncapsulate(global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle hKey, byte* pbSecretKey, uint cbSecretKey, out uint pcbSecretKey, byte* pbCipherText, uint cbCipherText, out uint pcbCipherText, uint dwFlags) 5567global::Interop.NCrypt.ErrorCode __retVal = default; 5593static extern unsafe global::Interop.NCrypt.ErrorCode __PInvoke(nint __hKey_native, byte* __pbSecretKey_native, uint __cbSecretKey_native, uint* __pcbSecretKey_native, byte* __pbCipherText_native, uint __cbCipherText_native, uint* __pcbCipherText_native, uint __dwFlags_native); 5602private static partial global::Interop.NCrypt.ErrorCode NCryptDeriveKey(global::Microsoft.Win32.SafeHandles.SafeNCryptSecretHandle hSharedSecret, string pwszKDF, ref global::Interop.NCrypt.NCryptBufferDesc pParameterList, byte[] pbDerivedKey, int cbDerivedKey, out int pcbResult, global::Interop.NCrypt.SecretAgreementFlags dwFlags) 5606global::Interop.NCrypt.ErrorCode __retVal = default; 5616fixed (global::Interop.NCrypt.NCryptBufferDesc* __pParameterList_native = &pParameterList) 5634static extern unsafe global::Interop.NCrypt.ErrorCode __PInvoke(nint __hSharedSecret_native, ushort* __pwszKDF_native, global::Interop.NCrypt.NCryptBufferDesc* __pParameterList_native, byte* __pbDerivedKey_native, int __cbDerivedKey_native, int* __pcbResult_native, global::Interop.NCrypt.SecretAgreementFlags __dwFlags_native); 5643private static partial global::Interop.NCrypt.ErrorCode NCryptDeriveKey(global::Microsoft.Win32.SafeHandles.SafeNCryptSecretHandle hSharedSecret, string pwszKDF, nint pParameterList, byte* pbDerivedKey, int cbDerivedKey, out int pcbResult, global::Interop.NCrypt.SecretAgreementFlags dwFlags) 5647global::Interop.NCrypt.ErrorCode __retVal = default; 5673static extern unsafe global::Interop.NCrypt.ErrorCode __PInvoke(nint __hSharedSecret_native, ushort* __pwszKDF_native, nint __pParameterList_native, byte* __pbDerivedKey_native, int __cbDerivedKey_native, int* __pcbResult_native, global::Interop.NCrypt.SecretAgreementFlags __dwFlags_native); 5682private static partial global::Interop.NCrypt.ErrorCode NCryptSecretAgreement(global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle hPrivKey, global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle hPubKey, out global::Microsoft.Win32.SafeHandles.SafeNCryptSecretHandle phSecret, int dwFlags) 5689global::Interop.NCrypt.ErrorCode __retVal = default; 5729static extern unsafe global::Interop.NCrypt.ErrorCode __PInvoke(nint __hPrivKey_native, nint __hPubKey_native, nint* __phSecret_native, int __dwFlags_native); 5738internal static extern partial global::Interop.NCrypt.ErrorCode NCryptFreeObject(nint hObject); 5746internal static partial global::Interop.NCrypt.ErrorCode NCryptOpenStorageProvider(out global::Microsoft.Win32.SafeHandles.SafeNCryptProviderHandle phProvider, string pszProviderName, int dwFlags) 5751global::Interop.NCrypt.ErrorCode __retVal = default; 5781static extern unsafe global::Interop.NCrypt.ErrorCode __PInvoke(nint* __phProvider_native, ushort* __pszProviderName_native, int __dwFlags_native); 5790internal static unsafe partial global::Interop.NCrypt.ErrorCode NCryptGetProperty(global::Microsoft.Win32.SafeHandles.SafeNCryptHandle hObject, string pszProperty, void* pbOutput, int cbOutput, out int pcbResult, global::System.Security.Cryptography.CngPropertyOptions dwFlags) 5794global::Interop.NCrypt.ErrorCode __retVal = default; 5820static extern unsafe global::Interop.NCrypt.ErrorCode __PInvoke(nint __hObject_native, ushort* __pszProperty_native, void* __pbOutput_native, int __cbOutput_native, int* __pcbResult_native, global::System.Security.Cryptography.CngPropertyOptions __dwFlags_native); 5829internal static unsafe partial global::Interop.NCrypt.ErrorCode NCryptSetProperty(global::Microsoft.Win32.SafeHandles.SafeNCryptHandle hObject, string pszProperty, void* pbInput, int cbInput, global::System.Security.Cryptography.CngPropertyOptions dwFlags) 5832global::Interop.NCrypt.ErrorCode __retVal = default; 5857static extern unsafe global::Interop.NCrypt.ErrorCode __PInvoke(nint __hObject_native, ushort* __pszProperty_native, void* __pbInput_native, int __cbInput_native, global::System.Security.Cryptography.CngPropertyOptions __dwFlags_native); 5866private static unsafe partial global::Interop.NCrypt.ErrorCode NCryptSignHash(global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle hKey, void* pPaddingInfo, byte* pbHashValue, int cbHashValue, byte* pbSignature, int cbSignature, out int pcbResult, global::Interop.NCrypt.AsymmetricPaddingMode dwFlags) 5870global::Interop.NCrypt.ErrorCode __retVal = default; 5895static extern unsafe global::Interop.NCrypt.ErrorCode __PInvoke(nint __hKey_native, void* __pPaddingInfo_native, byte* __pbHashValue_native, int __cbHashValue_native, byte* __pbSignature_native, int __cbSignature_native, int* __pcbResult_native, global::Interop.NCrypt.AsymmetricPaddingMode __dwFlags_native); 5904private static unsafe partial global::Interop.NCrypt.ErrorCode NCryptVerifySignature(global::Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle hKey, void* pPaddingInfo, byte* pbHashValue, int cbHashValue, byte* pbSignature, int cbSignature, global::Interop.NCrypt.AsymmetricPaddingMode dwFlags) 5907global::Interop.NCrypt.ErrorCode __retVal = default; 5930static extern unsafe global::Interop.NCrypt.ErrorCode __PInvoke(nint __hKey_native, void* __pPaddingInfo_native, byte* __pbHashValue_native, int __cbHashValue_native, byte* __pbSignature_native, int __cbSignature_native, global::Interop.NCrypt.AsymmetricPaddingMode __dwFlags_native);
Microsoft\Win32\SafeHandles\NCryptSafeHandles.cs (2)
11using ErrorCode = Interop.NCrypt.ErrorCode; 350ErrorCode errorCode = Interop.NCrypt.NCryptFreeObject(handle);
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.CryptAcquireContext_IntPtr.cs (1)
19Interop.Crypt32.CryptAcquireContextFlags dwFlags);
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\Interop\Windows\BCrypt\Cng.cs (2)
11using static Interop; 12using static Interop.BCrypt;
src\runtime\src\libraries\Common\src\Interop\Windows\BCrypt\Interop.BCryptSignHash.cs (2)
108if (status != Interop.BCrypt.NTSTATUS.STATUS_SUCCESS) 110throw Interop.BCrypt.CreateCryptographicException(status);
src\runtime\src\libraries\Common\src\Interop\Windows\Crypt32\Interop.CertCloseStore.cs (1)
12[LibraryImport(Interop.Libraries.Crypt32, SetLastError = true)]
src\runtime\src\libraries\Common\src\Interop\Windows\Crypt32\Interop.certificates.cs (2)
14[LibraryImport(Interop.Libraries.Crypt32, SetLastError = true)] 19[LibraryImport(Interop.Libraries.Crypt32, SetLastError = true)]
src\runtime\src\libraries\Common\src\Interop\Windows\Crypt32\Interop.FindOidInfo.cs (1)
128[LibraryImport(Interop.Libraries.Crypt32)]
src\runtime\src\libraries\Common\src\Interop\Windows\Crypt32\Interop.HashIdAlg.cs (1)
19public static unsafe CRYPT_OID_INFO FindAlgIdOidInfo(Interop.BCrypt.ECC_CURVE_ALG_ID_ENUM algId)
src\runtime\src\libraries\Common\src\Interop\Windows\NCrypt\Interop.EncryptDecrypt.cs (2)
13[LibraryImport(Interop.Libraries.NCrypt)] 17[LibraryImport(Interop.Libraries.NCrypt)]
src\runtime\src\libraries\Common\src\Interop\Windows\NCrypt\Interop.Keys.cs (10)
20[LibraryImport(Interop.Libraries.NCrypt, StringMarshalling = StringMarshalling.Utf16)] 24[LibraryImport(Interop.Libraries.NCrypt, StringMarshalling = StringMarshalling.Utf16)] 28[LibraryImport(Interop.Libraries.NCrypt, StringMarshalling = StringMarshalling.Utf16)] 32[LibraryImport(Interop.Libraries.NCrypt, StringMarshalling = StringMarshalling.Utf16)] 36[LibraryImport(Interop.Libraries.NCrypt, StringMarshalling = StringMarshalling.Utf16)] 40[LibraryImport(Interop.Libraries.NCrypt, StringMarshalling = StringMarshalling.Utf16)] 52[LibraryImport(Interop.Libraries.NCrypt, StringMarshalling = StringMarshalling.Utf16)] 56[LibraryImport(Interop.Libraries.NCrypt, StringMarshalling = StringMarshalling.Utf16)] 60[LibraryImport(Interop.Libraries.NCrypt, StringMarshalling = StringMarshalling.Utf16)] 64[LibraryImport(Interop.Libraries.NCrypt, StringMarshalling = StringMarshalling.Utf16)]
src\runtime\src\libraries\Common\src\Interop\Windows\NCrypt\Interop.NCryptDeriveKeyMaterial.cs (2)
19[LibraryImport(Interop.Libraries.NCrypt, StringMarshalling = StringMarshalling.Utf16)] 30[LibraryImport(Interop.Libraries.NCrypt, StringMarshalling = StringMarshalling.Utf16)]
src\runtime\src\libraries\Common\src\Interop\Windows\NCrypt\Interop.NCryptDeriveSecretAgreement.cs (1)
25[LibraryImport(Interop.Libraries.NCrypt)]
src\runtime\src\libraries\Common\src\Interop\Windows\NCrypt\Interop.NCryptFreeObject.cs (1)
12[LibraryImport(Interop.Libraries.NCrypt)]
src\runtime\src\libraries\Common\src\Interop\Windows\NCrypt\Interop.NCryptOpenStorageProvider.cs (1)
12[LibraryImport(Interop.Libraries.NCrypt, StringMarshalling = StringMarshalling.Utf16)]
src\runtime\src\libraries\Common\src\Interop\Windows\NCrypt\Interop.Properties.cs (4)
15[LibraryImport(Interop.Libraries.NCrypt, StringMarshalling = StringMarshalling.Utf16)] 25[LibraryImport(Interop.Libraries.NCrypt, StringMarshalling = StringMarshalling.Utf16)] 37ErrorCode errorCode = Interop.NCrypt.NCryptGetProperty( 58ErrorCode errorCode = Interop.NCrypt.NCryptGetProperty(
src\runtime\src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeBCryptAlgorithmHandle.cs (2)
7using NTSTATUS = Interop.BCrypt.NTSTATUS; 20NTSTATUS ntStatus = Interop.BCrypt.BCryptCloseAlgorithmProvider(handle, 0);
src\runtime\src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeBCryptHandle.cs (1)
7using NTSTATUS = Interop.BCrypt.NTSTATUS;
src\runtime\src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeBCryptHashHandle.cs (2)
7using NTSTATUS = Interop.BCrypt.NTSTATUS; 20NTSTATUS ntStatus = Interop.BCrypt.BCryptDestroyHash(handle);
src\runtime\src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeBCryptKeyHandle.cs (2)
7using NTSTATUS = Interop.BCrypt.NTSTATUS; 20NTSTATUS ntStatus = Interop.BCrypt.BCryptDestroyKey(handle);
src\runtime\src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeBCryptSecretHandle.cs (2)
4using NTSTATUS = Interop.BCrypt.NTSTATUS; 12NTSTATUS ntStatus = Interop.BCrypt.BCryptDestroySecret(handle);
src\runtime\src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeCertContextHandle.cs (1)
8using static Interop.Crypt32;
src\runtime\src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeCertContextHandleWithKeyContainerDeletion.cs (12)
18using (SafeCertContextHandle certContext = Interop.Crypt32.CertDuplicateCertificateContext(handle)) 32bool containsPrivateKey = Interop.Crypt32.CertGetCertificateContextProperty(pCertContext, Interop.Crypt32.CertContextPropId.CERT_KEY_PROV_INFO_PROP_ID, null, ref cb); 37if (!Interop.Crypt32.CertGetCertificateContextProperty(pCertContext, Interop.Crypt32.CertContextPropId.CERT_KEY_PROV_INFO_PROP_ID, provInfoAsBytes, ref cb)) 44Interop.Crypt32.CRYPT_KEY_PROV_INFO* pProvInfo = (Interop.Crypt32.CRYPT_KEY_PROV_INFO*)pProvInfoAsBytes; 55if ((pProvInfo->dwFlags & Interop.Crypt32.CryptAcquireContextFlags.CRYPT_MACHINE_KEYSET) != 0) 75Interop.Crypt32.CryptAcquireContextFlags flags = (pProvInfo->dwFlags & Interop.Crypt32.CryptAcquireContextFlags.CRYPT_MACHINE_KEYSET) | Interop.Crypt32.CryptAcquireContextFlags.CRYPT_DELETEKEYSET; 77_ = Interop.Advapi32.CryptAcquireContext(out hProv, pProvInfo->pwszContainerName, pProvInfo->pwszProvName, pProvInfo->dwProvType, flags);
src\runtime\src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeCertStoreHandle.cs (1)
13bool success = Interop.Crypt32.CertCloseStore(handle, 0);
src\runtime\src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeChainEngineHandle.cs (3)
22new SafeChainEngineHandle((IntPtr)Interop.Crypt32.ChainEngine.HCCE_LOCAL_MACHINE); 25new SafeChainEngineHandle((IntPtr)Interop.Crypt32.ChainEngine.HCCE_CURRENT_USER); 29Interop.Crypt32.CertFreeCertificateChainEngine(handle);
src\runtime\src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeCryptMsgHandle.cs (1)
13bool success = Interop.Crypt32.CryptMsgClose(handle);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\AeadCommon.Windows.cs (1)
7using static Interop.BCrypt;
src\runtime\src\libraries\Common\src\System\Security\Cryptography\AesGcm.Windows.cs (1)
23_keyHandle = Interop.BCrypt.BCryptImportKey(BCryptAeadHandleCache.AesGcm, key);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\CngHelpers.cs (27)
9using ErrorCode = Interop.NCrypt.ErrorCode; 15internal static CryptographicException ToCryptographicException(this Interop.NCrypt.ErrorCode errorCode) 22ErrorCode errorCode = Interop.NCrypt.NCryptOpenStorageProvider( 40ErrorCode errorCode = Interop.NCrypt.NCryptSetProperty( 66ErrorCode errorCode = Interop.NCrypt.NCryptGetProperty( 88errorCode = Interop.NCrypt.NCryptGetProperty( 152ErrorCode errorCode = Interop.NCrypt.NCryptExportKey(handle, IntPtr.Zero, blobType, IntPtr.Zero, null, 0, out numBytesNeeded, 0); 162errorCode = Interop.NCrypt.NCryptExportKey(handle, IntPtr.Zero, blobType, IntPtr.Zero, buffer, buffer.Length, out numBytesNeeded, 0); 187ErrorCode errorCode = Interop.NCrypt.NCryptExportKey( 208errorCode = Interop.NCrypt.NCryptExportKey( 241Interop.NCrypt.NCryptBuffer* buffers = stackalloc Interop.NCrypt.NCryptBuffer[3]; 243Interop.NCrypt.PBE_PARAMS pbeParams = default; 244Span<byte> salt = new Span<byte>(pbeParams.rgbSalt, Interop.NCrypt.PBE_PARAMS.RgbSaltSize); 249buffers[0] = new Interop.NCrypt.NCryptBuffer 251BufferType = Interop.NCrypt.BufferType.PkcsSecret, 261buffers[1] = new Interop.NCrypt.NCryptBuffer 263BufferType = Interop.NCrypt.BufferType.PkcsAlgOid, 268buffers[2] = new Interop.NCrypt.NCryptBuffer 270BufferType = Interop.NCrypt.BufferType.PkcsAlgParam, 271cbBuffer = sizeof(Interop.NCrypt.PBE_PARAMS), 275Interop.NCrypt.NCryptBufferDesc desc = new Interop.NCrypt.NCryptBufferDesc 284ErrorCode errorCode = Interop.NCrypt.NCryptExportKey( 287Interop.NCrypt.NCRYPT_PKCS8_PRIVATE_KEY_BLOB, 312errorCode = Interop.NCrypt.NCryptExportKey( 315Interop.NCrypt.NCRYPT_PKCS8_PRIVATE_KEY_BLOB,
src\runtime\src\libraries\Common\src\System\Security\Cryptography\CngHelpers.SignVerify.cs (11)
6using AsymmetricPaddingMode = Interop.NCrypt.AsymmetricPaddingMode; 7using ErrorCode = Interop.NCrypt.ErrorCode; 22ErrorCode errorCode = Interop.NCrypt.NCryptSignHash(keyHandle, pPaddingInfo, hash, signature, out numBytesNeeded, paddingMode); 26errorCode = Interop.NCrypt.NCryptSignHash(keyHandle, pPaddingInfo, hash, signature, out numBytesNeeded, paddingMode); 32errorCode = Interop.NCrypt.NCryptSignHash(keyHandle, pPaddingInfo, hash, signature, out numBytesNeeded, paddingMode); 37errorCode = Interop.NCrypt.NCryptSignHash(keyHandle, pPaddingInfo, hash, signature, out numBytesNeeded, paddingMode); 54ErrorCode errorCode = Interop.NCrypt.NCryptSignHash(keyHandle, pPaddingInfo, hash, destination, out int numBytesNeeded, paddingMode); 58errorCode = Interop.NCrypt.NCryptSignHash(keyHandle, pPaddingInfo, hash, destination, out numBytesNeeded, paddingMode); 73ErrorCode error = Interop.NCrypt.NCryptSignHash( 106ErrorCode errorCode = Interop.NCrypt.NCryptVerifySignature(keyHandle, pPaddingInfo, hash, hash.Length, signature, signature.Length, paddingMode); 110errorCode = Interop.NCrypt.NCryptVerifySignature(keyHandle, pPaddingInfo, hash, hash.Length, signature, signature.Length, paddingMode);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\CompositeMLDsaCng.Windows.cs (4)
77Interop.BCrypt.BCRYPT_PQDSA_PADDING_INFO paddingInfo = default; 88Interop.NCrypt.AsymmetricPaddingMode.NCRYPT_PAD_PQDSA_FLAG, 111Interop.BCrypt.BCRYPT_PQDSA_PADDING_INFO paddingInfo = default; 120Interop.NCrypt.AsymmetricPaddingMode.NCRYPT_PAD_PQDSA_FLAG,
src\runtime\src\libraries\Common\src\System\Security\Cryptography\CompositeMLDsaImplementation.Windows.cs (16)
12using NTSTATUS = Interop.BCrypt.NTSTATUS; 47return Interop.BCrypt.BCryptSignHashPqcPure(_key, data, context, destination); 51Interop.BCrypt.BCryptVerifySignaturePqcPure(_key, data, context, signature); 63SafeBCryptKeyHandle keyHandle = Interop.BCrypt.BCryptGenerateKeyPair(s_algHandle, keyLength: 0); 67Interop.BCrypt.BCryptSetSZProperty(keyHandle, Interop.BCrypt.BCryptPropertyStrings.BCRYPT_PARAMETER_SET_NAME, parameterSet); 68Interop.BCrypt.BCryptFinalizeKeyPair(keyHandle); 89const string PublicBlobType = Interop.BCrypt.KeyBlobType.BCRYPT_PQDSA_PUBLIC_BLOB; 96static blob => Interop.BCrypt.BCryptImportKeyPair(s_algHandle, PublicBlobType, blob)); 111const string PrivateBlobType = Interop.BCrypt.KeyBlobType.BCRYPT_PQDSA_PRIVATE_BLOB; 118static blob => Interop.BCrypt.BCryptImportKeyPair(s_algHandle, PrivateBlobType, blob)); 134ExportKey(Interop.BCrypt.KeyBlobType.BCRYPT_PQDSA_PUBLIC_BLOB, destination); 143return ExportKey(Interop.BCrypt.KeyBlobType.BCRYPT_PQDSA_PRIVATE_BLOB, destination); 159ArraySegment<byte> keyBlob = Interop.BCrypt.BCryptExportKey(_key, keyBlobType); 202NTSTATUS status = Interop.BCrypt.BCryptOpenAlgorithmProvider( 206Interop.BCrypt.BCryptOpenAlgorithmProviderFlags.None);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\CryptoThrowHelper.Windows.cs (1)
19string message = Interop.Kernel32.GetMessage(hr);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\DSACng.ImportExport.cs (34)
7using static Interop.BCrypt; 8using static Interop.NCrypt; 9using KeyBlobMagicNumber = Interop.BCrypt.KeyBlobMagicNumber; 199Interop.BCrypt.EmitBigEndian(blob, ref offset, parameters.Counter); 200Interop.BCrypt.Emit(blob, ref offset, parameters.Seed); 206Interop.BCrypt.EmitByte(blob, ref offset, 0xff, Sha1HashOutputSize + sizeof(int)); 213Interop.BCrypt.Emit(blob, ref offset, parameters.Q); 217Interop.BCrypt.Emit(blob, ref offset, parameters.P!); 218Interop.BCrypt.Emit(blob, ref offset, parameters.G!); 219Interop.BCrypt.Emit(blob, ref offset, parameters.Y!); 222Interop.BCrypt.Emit(blob, ref offset, parameters.X!); 279Interop.BCrypt.EmitBigEndian(blob, ref offset, parameters.Counter); 283Interop.BCrypt.Emit(blob, ref offset, parameters.Seed); 289Interop.BCrypt.EmitByte(blob, ref offset, 0xff, sizeof(int)); 294Interop.BCrypt.EmitByte(blob, ref offset, 0xff, defaultSeedLength); 297Interop.BCrypt.Emit(blob, ref offset, parameters.Q); 298Interop.BCrypt.Emit(blob, ref offset, parameters.P); 299Interop.BCrypt.Emit(blob, ref offset, parameters.G); 300Interop.BCrypt.Emit(blob, ref offset, parameters.Y); 304Interop.BCrypt.Emit(blob, ref offset, parameters.X!); 359dsaParams.Counter = BinaryPrimitives.ReadInt32BigEndian(Interop.BCrypt.Consume(dsaBlob, ref offset, 4)); 360dsaParams.Seed = Interop.BCrypt.Consume(dsaBlob, ref offset, Sha1HashOutputSize); 361dsaParams.Q = Interop.BCrypt.Consume(dsaBlob, ref offset, Sha1HashOutputSize); 364dsaParams.P = Interop.BCrypt.Consume(dsaBlob, ref offset, pBcryptBlob->cbKey); 365dsaParams.G = Interop.BCrypt.Consume(dsaBlob, ref offset, pBcryptBlob->cbKey); 366dsaParams.Y = Interop.BCrypt.Consume(dsaBlob, ref offset, pBcryptBlob->cbKey); 369dsaParams.X = Interop.BCrypt.Consume(dsaBlob, ref offset, Sha1HashOutputSize); 393dsaParams.Counter = BinaryPrimitives.ReadInt32BigEndian(Interop.BCrypt.Consume(dsaBlob, ref offset, 4)); 397dsaParams.Seed = Interop.BCrypt.Consume(dsaBlob, ref offset, pBcryptBlob->cbSeedLength); 398dsaParams.Q = Interop.BCrypt.Consume(dsaBlob, ref offset, pBcryptBlob->cbGroupSize); 399dsaParams.P = Interop.BCrypt.Consume(dsaBlob, ref offset, pBcryptBlob->cbKey); 400dsaParams.G = Interop.BCrypt.Consume(dsaBlob, ref offset, pBcryptBlob->cbKey); 401dsaParams.Y = Interop.BCrypt.Consume(dsaBlob, ref offset, pBcryptBlob->cbKey); 404dsaParams.X = Interop.BCrypt.Consume(dsaBlob, ref offset, pBcryptBlob->cbGroupSize);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\DSACng.SignVerify.cs (2)
7using static Interop.BCrypt; 8using static Interop.NCrypt;
src\runtime\src\libraries\Common\src\System\Security\Cryptography\ECCng.HashAlgorithm.cs (7)
6using static Interop.Crypt32; 15internal static Interop.BCrypt.ECC_CURVE_ALG_ID_ENUM GetHashAlgorithmId(HashAlgorithmName? name) 19return Interop.BCrypt.ECC_CURVE_ALG_ID_ENUM.BCRYPT_NO_CURVE_GENERATION_ALG_ID; 22CRYPT_OID_INFO oid = Interop.Crypt32.FindOidInfo( 33return (Interop.BCrypt.ECC_CURVE_ALG_ID_ENUM)oid.AlgId; 39internal static HashAlgorithmName? GetHashAlgorithmName(Interop.BCrypt.ECC_CURVE_ALG_ID_ENUM hashId) 41CRYPT_OID_INFO oid = Interop.Crypt32.FindAlgIdOidInfo(hashId);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\ECCng.ImportExport.cs (38)
6using BCRYPT_ECC_PARAMETER_HEADER = Interop.BCrypt.BCRYPT_ECC_PARAMETER_HEADER; 7using BCRYPT_ECCFULLKEY_BLOB = Interop.BCrypt.BCRYPT_ECCFULLKEY_BLOB; 8using ErrorCode = Interop.NCrypt.ErrorCode; 9using KeyBlobMagicNumber = Interop.BCrypt.KeyBlobMagicNumber; 93Interop.BCrypt.Emit(blob, ref offset, curve.Prime); 94Interop.BCrypt.Emit(blob, ref offset, curve.A); 95Interop.BCrypt.Emit(blob, ref offset, curve.B); 96Interop.BCrypt.Emit(blob, ref offset, curve.G.X); 97Interop.BCrypt.Emit(blob, ref offset, curve.G.Y); 98Interop.BCrypt.Emit(blob, ref offset, curve.Order); 99Interop.BCrypt.Emit(blob, ref offset, curve.Cofactor); 102Interop.BCrypt.Emit(blob, ref offset, curve.Seed); 104Interop.BCrypt.Emit(blob, ref offset, parameters.Q.X); 105Interop.BCrypt.Emit(blob, ref offset, parameters.Q.Y); 108Interop.BCrypt.Emit(blob, ref offset, parameters.D!); 200primeCurve.Prime = Interop.BCrypt.Consume(ecBlob, ref offset, pBcryptBlob->cbFieldLength); 201primeCurve.A = Interop.BCrypt.Consume(ecBlob, ref offset, pBcryptBlob->cbFieldLength); 202primeCurve.B = Interop.BCrypt.Consume(ecBlob, ref offset, pBcryptBlob->cbFieldLength); 205X = Interop.BCrypt.Consume(ecBlob, ref offset, pBcryptBlob->cbFieldLength), 206Y = Interop.BCrypt.Consume(ecBlob, ref offset, pBcryptBlob->cbFieldLength), 208primeCurve.Order = Interop.BCrypt.Consume(ecBlob, ref offset, pBcryptBlob->cbSubgroupOrder); 209primeCurve.Cofactor = Interop.BCrypt.Consume(ecBlob, ref offset, pBcryptBlob->cbCofactor); 212primeCurve.Seed = pBcryptBlob->cbSeed == 0 ? null : Interop.BCrypt.Consume(ecBlob, ref offset, pBcryptBlob->cbSeed); 216X = Interop.BCrypt.Consume(ecBlob, ref offset, pBcryptBlob->cbFieldLength), 217Y = Interop.BCrypt.Consume(ecBlob, ref offset, pBcryptBlob->cbFieldLength) 222ecParams.D = Interop.BCrypt.Consume(ecBlob, ref offset, pBcryptBlob->cbSubgroupOrder); 258pBcryptBlob->Version = Interop.BCrypt.BCRYPT_ECC_PARAMETER_HEADER_V1; 268Interop.BCrypt.Emit(blob, ref offset, curve.Prime); 269Interop.BCrypt.Emit(blob, ref offset, curve.A); 270Interop.BCrypt.Emit(blob, ref offset, curve.B); 271Interop.BCrypt.Emit(blob, ref offset, curve.G.X); 272Interop.BCrypt.Emit(blob, ref offset, curve.G.Y); 273Interop.BCrypt.Emit(blob, ref offset, curve.Order); 274Interop.BCrypt.Emit(blob, ref offset, curve.Cofactor); 277Interop.BCrypt.Emit(blob, ref offset, curve.Seed); 400private static Interop.BCrypt.ECC_CURVE_TYPE_ENUM ConvertToCurveTypeEnum(ECCurve.ECCurveType value) 406return (Interop.BCrypt.ECC_CURVE_TYPE_ENUM)value; 412private static ECCurve.ECCurveType ConvertToCurveTypeEnum(Interop.BCrypt.ECC_CURVE_TYPE_ENUM value)
src\runtime\src\libraries\Common\src\System\Security\Cryptography\ECCng.ImportExport.NamedCurve.cs (14)
7using BCRYPT_ECCKEY_BLOB = Interop.BCrypt.BCRYPT_ECCKEY_BLOB; 8using ErrorCode = Interop.NCrypt.ErrorCode; 9using KeyBlobMagicNumber = Interop.BCrypt.KeyBlobMagicNumber; 58Interop.BCrypt.Emit(blob, ref offset, x); 59Interop.BCrypt.Emit(blob, ref offset, y); 64Interop.BCrypt.Emit(blob, ref offset, d!); 108byte[] x = Interop.BCrypt.Consume(ecBlob, ref offset, pBcryptBlob->cbKey); 109byte[] y = Interop.BCrypt.Consume(ecBlob, ref offset, pBcryptBlob->cbKey); 119Interop.BCrypt.Consume(ecBlob, ref offset, d.Length, d); 158Interop.BCrypt.BCryptBufferDesc desc = default; 159Interop.BCrypt.BCryptBuffer buff = default; 162buff.BufferType = Interop.BCrypt.CngBufferDescriptors.NCRYPTBUFFER_ECC_CURVE_NAME; 167desc.ulVersion = Interop.BCrypt.BCRYPTBUFFER_VERSION; 169errorCode = Interop.NCrypt.NCryptImportKey(
src\runtime\src\libraries\Common\src\System\Security\Cryptography\ECDiffieHellmanCng.cs (10)
83return Interop.NCrypt.DeriveKeyMaterialHash( 88Interop.NCrypt.SecretAgreementFlags.None); 104Interop.NCrypt.SecretAgreementFlags flags = hmacKey == null ? 105Interop.NCrypt.SecretAgreementFlags.UseSecretAsHmacKey : 106Interop.NCrypt.SecretAgreementFlags.None; 108return Interop.NCrypt.DeriveKeyMaterialHmac( 126return Interop.NCrypt.DeriveKeyMaterialTls( 130Interop.NCrypt.SecretAgreementFlags.None); 141return Interop.NCrypt.DeriveKeyMaterialTruncate( 143Interop.NCrypt.SecretAgreementFlags.None);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\ECDsaCng.SignVerify.cs (1)
7using AsymmetricPaddingMode = Interop.NCrypt.AsymmetricPaddingMode;
src\runtime\src\libraries\Common\src\System\Security\Cryptography\MLDsaCng.Windows.cs (6)
10using BCRYPT_PQDSA_PADDING_INFO = Interop.BCrypt.BCRYPT_PQDSA_PADDING_INFO; 241Interop.NCrypt.NCRYPT_PKCS8_PRIVATE_KEY_BLOB, 260Interop.NCrypt.AsymmetricPaddingMode.NCRYPT_PAD_PQDSA_FLAG, 280Interop.NCrypt.AsymmetricPaddingMode.NCRYPT_PAD_PQDSA_FLAG, 315Interop.NCrypt.AsymmetricPaddingMode.NCRYPT_PAD_PQDSA_FLAG, 350Interop.NCrypt.AsymmetricPaddingMode.NCRYPT_PAD_PQDSA_FLAG,
src\runtime\src\libraries\Common\src\System\Security\Cryptography\MLDsaImplementation.CreateCng.cs (4)
16_hasSeed ? Interop.BCrypt.KeyBlobType.BCRYPT_PQDSA_PRIVATE_SEED_BLOB : 17_hasPrivateKey ? Interop.BCrypt.KeyBlobType.BCRYPT_PQDSA_PRIVATE_BLOB : 18Interop.BCrypt.KeyBlobType.BCRYPT_PQDSA_PUBLIC_BLOB; 25CngKey key = Interop.BCrypt.BCryptExportKey(
src\runtime\src\libraries\Common\src\System\Security\Cryptography\MLDsaImplementation.Windows.cs (22)
10using NTSTATUS = Interop.BCrypt.NTSTATUS; 47int written = Interop.BCrypt.BCryptSignHashPqcPure(_key, data, context, destination); 51Debug.Fail($"Expected {destination.Length} bytes, but {nameof(Interop.BCrypt.BCryptSignHashPqcPure)} wrote {written} bytes."); 57Interop.BCrypt.BCryptVerifySignaturePqcPure(_key, data, context, signature); 79Interop.BCrypt.BCryptSignHashPqcPreHash(_key, hash, hashAlgorithmIdentifier, context, destination); 97return Interop.BCrypt.BCryptVerifySignaturePqcPreHash(_key, hash, hashAlgorithmIdentifier, context, signature); 111SafeBCryptKeyHandle keyHandle = Interop.BCrypt.BCryptGenerateKeyPair(s_algHandle, keyLength: 0); 115Interop.BCrypt.BCryptSetSZProperty(keyHandle, Interop.BCrypt.BCryptPropertyStrings.BCRYPT_PARAMETER_SET_NAME, parameterSet); 116Interop.BCrypt.BCryptFinalizeKeyPair(keyHandle); 131const string PublicBlobType = Interop.BCrypt.KeyBlobType.BCRYPT_PQDSA_PUBLIC_BLOB; 138static blob => Interop.BCrypt.BCryptImportKeyPair(s_algHandle, PublicBlobType, blob)); 147const string PrivateBlobType = Interop.BCrypt.KeyBlobType.BCRYPT_PQDSA_PRIVATE_BLOB; 154static blob => Interop.BCrypt.BCryptImportKeyPair(s_algHandle, PrivateBlobType, blob)); 163const string PrivateSeedBlobType = Interop.BCrypt.KeyBlobType.BCRYPT_PQDSA_PRIVATE_SEED_BLOB; 170static blob => Interop.BCrypt.BCryptImportKeyPair(s_algHandle, PrivateSeedBlobType, blob)); 177Interop.BCrypt.KeyBlobType.BCRYPT_PQDSA_PUBLIC_BLOB, 189Interop.BCrypt.KeyBlobType.BCRYPT_PQDSA_PRIVATE_BLOB, 202Interop.BCrypt.KeyBlobType.BCRYPT_PQDSA_PRIVATE_SEED_BLOB, 230ArraySegment<byte> keyBlob = Interop.BCrypt.BCryptExportKey(_key, keyBlobType); 268NTSTATUS status = Interop.BCrypt.BCryptOpenAlgorithmProvider( 272Interop.BCrypt.BCryptOpenAlgorithmProviderFlags.None);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\MLKem.Windows.cs (2)
7using KeyBlobMagicNumber = Interop.BCrypt.KeyBlobMagicNumber; 8using BCRYPT_MLKEM_KEY_BLOB = Interop.BCrypt.BCRYPT_MLKEM_KEY_BLOB;
src\runtime\src\libraries\Common\src\System\Security\Cryptography\MLKemCng.Windows.cs (6)
11using KeyBlobMagicNumber = Interop.BCrypt.KeyBlobMagicNumber; 12using ErrorCode = Interop.NCrypt.ErrorCode; 101uint written = Interop.NCrypt.NCryptDecapsulate(duplicatedHandle, ciphertext, sharedSecret, 0); 115Interop.NCrypt.NCryptEncapsulate( 237ErrorCode errorCode = Interop.NCrypt.NCryptExportKey( 257errorCode = Interop.NCrypt.NCryptExportKey(
src\runtime\src\libraries\Common\src\System\Security\Cryptography\MLKemImplementation.Windows.cs (14)
9using NTSTATUS = Interop.BCrypt.NTSTATUS; 10using KeyBlobMagicNumber = Interop.BCrypt.KeyBlobMagicNumber; 11using KeyBlobType = Interop.BCrypt.KeyBlobType; 12using BCRYPT_MLKEM_KEY_BLOB = Interop.BCrypt.BCRYPT_MLKEM_KEY_BLOB; 39SafeBCryptKeyHandle keyHandle = Interop.BCrypt.BCryptGenerateKeyPair(s_algHandle, keyLength: 0); 43Interop.BCrypt.BCryptSetSZProperty(keyHandle, Interop.BCrypt.BCryptPropertyStrings.BCRYPT_PARAMETER_SET_NAME, parameterSet); 44Interop.BCrypt.BCryptFinalizeKeyPair(keyHandle); 87uint written = Interop.BCrypt.BCryptDecapsulate(_key, ciphertext, sharedSecret, 0); 96Interop.BCrypt.BCryptEncapsulate( 146NTSTATUS status = Interop.BCrypt.BCryptOpenAlgorithmProvider( 150Interop.BCrypt.BCryptOpenAlgorithmProviderFlags.None); 166ArraySegment<byte> key = Interop.BCrypt.BCryptExportKey(_key, blobKind); 194static (algHandle, blobKind, blob) => Interop.BCrypt.BCryptImportKeyPair(
src\runtime\src\libraries\Common\src\System\Security\Cryptography\PqcBlobHelpers.cs (14)
10using KeyBlobType = Interop.BCrypt.KeyBlobType; 11using KeyBlobMagicNumber = Interop.BCrypt.KeyBlobMagicNumber; 12using BCRYPT_MLKEM_KEY_BLOB = Interop.BCrypt.BCRYPT_MLKEM_KEY_BLOB; 13using BCRYPT_PQDSA_KEY_BLOB = Interop.BCrypt.BCRYPT_PQDSA_KEY_BLOB; 91case Interop.BCrypt.KeyBlobType.BCRYPT_PQDSA_PUBLIC_BLOB: 94case Interop.BCrypt.KeyBlobType.BCRYPT_PQDSA_PRIVATE_BLOB: 97case Interop.BCrypt.KeyBlobType.BCRYPT_PQDSA_PRIVATE_SEED_BLOB: 118case Interop.BCrypt.KeyBlobType.BCRYPT_PQDSA_PUBLIC_BLOB: 121case Interop.BCrypt.KeyBlobType.BCRYPT_PQDSA_PRIVATE_BLOB: 142blobType = Interop.BCrypt.KeyBlobType.BCRYPT_PQDSA_PUBLIC_BLOB; 145blobType = Interop.BCrypt.KeyBlobType.BCRYPT_PQDSA_PRIVATE_BLOB; 148blobType = Interop.BCrypt.KeyBlobType.BCRYPT_PQDSA_PRIVATE_SEED_BLOB; 168blobType = Interop.BCrypt.KeyBlobType.BCRYPT_PQDSA_PUBLIC_BLOB; 171blobType = Interop.BCrypt.KeyBlobType.BCRYPT_PQDSA_PRIVATE_BLOB;
src\runtime\src\libraries\Common\src\System\Security\Cryptography\RSACng.EncryptDecrypt.cs (5)
7using AsymmetricPaddingMode = Interop.NCrypt.AsymmetricPaddingMode; 8using BCRYPT_OAEP_PADDING_INFO = Interop.BCrypt.BCRYPT_OAEP_PADDING_INFO; 9using ErrorCode = Interop.NCrypt.ErrorCode; 290Interop.NCrypt.NCryptEncrypt(key, input, input.Length, paddingInfo, output, output.Length, out bytesNeeded, paddingMode) : 291Interop.NCrypt.NCryptDecrypt(key, input, input.Length, paddingInfo, output, output.Length, out bytesNeeded, paddingMode);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\RSACng.SignVerify.cs (3)
9using AsymmetricPaddingMode = Interop.NCrypt.AsymmetricPaddingMode; 10using BCRYPT_PKCS1_PADDING_INFO = Interop.BCrypt.BCRYPT_PKCS1_PADDING_INFO; 11using BCRYPT_PSS_PADDING_INFO = Interop.BCrypt.BCRYPT_PSS_PADDING_INFO;
src\runtime\src\libraries\Common\src\System\Security\Cryptography\SP800108HmacCounterKdfImplementationCng.cs (14)
6using BCryptBuffer = Interop.BCrypt.BCryptBuffer; 7using CngBufferDescriptors = Interop.BCrypt.CngBufferDescriptors; 8using NTSTATUS = Interop.BCrypt.NTSTATUS; 62Interop.BCrypt.BCryptBufferDesc bufferDesc; 63bufferDesc.ulVersion = Interop.BCrypt.BCRYPTBUFFER_VERSION; 67NTSTATUS deriveStatus = Interop.BCrypt.BCryptKeyDerivation( 77throw Interop.BCrypt.CreateCryptographicException(deriveStatus); 138generateKeyStatus = Interop.BCrypt.BCryptGenerateSymmetricKey( 149generateKeyStatus = Interop.BCrypt.BCryptGenerateSymmetricKey( 162throw Interop.BCrypt.CreateCryptographicException(generateKeyStatus); 173if (!Interop.BCrypt.PseudoHandlesSupported) 175NTSTATUS openStatus = Interop.BCrypt.BCryptOpenAlgorithmProvider( 179Interop.BCrypt.BCryptOpenAlgorithmProviderFlags.None); 184throw Interop.BCrypt.CreateCryptographicException(openStatus);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\X25519DiffieHellmanCng.Windows.cs (7)
10using ErrorCode = Interop.NCrypt.ErrorCode; 81const int NCRYPT_NO_KEY_VALIDATION = (int)Interop.BCrypt.BCryptImportKeyPairFlags.BCRYPT_NO_KEY_VALIDATION; 94using (SafeNCryptSecretHandle secretAgreement = Interop.NCrypt.DeriveSecretAgreement( 104bool success = Interop.NCrypt.TryDeriveKeyMaterialTruncate( 106Interop.NCrypt.SecretAgreementFlags.None, 182ErrorCode errorCode = Interop.NCrypt.NCryptExportKey( 199errorCode = Interop.NCrypt.NCryptExportKey(
src\runtime\src\libraries\Common\src\System\Security\Cryptography\X25519DiffieHellmanImplementation.Windows.cs (16)
11using NTSTATUS = Interop.BCrypt.NTSTATUS; 75using (SafeBCryptSecretHandle secret = Interop.BCrypt.BCryptSecretAgreement(_key, otherPartyKey)) 77Interop.BCrypt.BCryptDeriveKey( 80in Unsafe.NullRef<Interop.BCrypt.BCryptBufferDesc>(), 146SafeBCryptKeyHandle key = Interop.BCrypt.BCryptGenerateKeyPair(s_algHandle, 0); 151Interop.BCrypt.BCryptFinalizeKeyPair(key); 197Interop.BCrypt.KeyBlobType.BCRYPT_ECCPRIVATE_BLOB : 198Interop.BCrypt.KeyBlobType.BCRYPT_ECCPUBLIC_BLOB; 200ArraySegment<byte> key = Interop.BCrypt.BCryptExportKey(_key, blobType); 223Interop.BCrypt.KeyBlobType.BCRYPT_ECCPRIVATE_BLOB : 224Interop.BCrypt.KeyBlobType.BCRYPT_ECCPUBLIC_BLOB; 229return Interop.BCrypt.BCryptImportKeyPair( 233Interop.BCrypt.BCryptImportKeyPairFlags.BCRYPT_NO_KEY_VALIDATION); 239NTSTATUS status = Interop.BCrypt.BCryptOpenAlgorithmProvider( 243Interop.BCrypt.BCryptOpenAlgorithmProviderFlags.None); 255status = Interop.BCrypt.BCryptSetProperty(
src\runtime\src\libraries\Common\src\System\Security\Cryptography\X25519WindowsHelpers.cs (12)
24Interop.BCrypt.KeyBlobMagicNumber expectedMagicNumber = privateKey ? 25Interop.BCrypt.KeyBlobMagicNumber.BCRYPT_ECDH_PRIVATE_GENERIC_MAGIC : 26Interop.BCrypt.KeyBlobMagicNumber.BCRYPT_ECDH_PUBLIC_GENERIC_MAGIC; 30int blobHeaderSize = sizeof(Interop.BCrypt.BCRYPT_ECCKEY_BLOB); 40Interop.BCrypt.BCRYPT_ECCKEY_BLOB* blob = (Interop.BCrypt.BCRYPT_ECCKEY_BLOB*)pExportedSpan; 75Interop.BCrypt.KeyBlobMagicNumber magicNumber = privateKey ? 76Interop.BCrypt.KeyBlobMagicNumber.BCRYPT_ECDH_PRIVATE_GENERIC_MAGIC : 77Interop.BCrypt.KeyBlobMagicNumber.BCRYPT_ECDH_PUBLIC_GENERIC_MAGIC; 81int blobHeaderSize = sizeof(Interop.BCrypt.BCRYPT_ECCKEY_BLOB); 94Interop.BCrypt.BCRYPT_ECCKEY_BLOB* blob = (Interop.BCrypt.BCRYPT_ECCKEY_BLOB*)pBlobHeader;
src\runtime\src\libraries\Common\src\System\Security\Cryptography\X509Certificates\CertificateHelpers.Windows.cs (21)
141if (Interop.Crypt32.CertGetCertificateContextProperty( 143Interop.Crypt32.CertContextPropId.CERT_NCRYPT_KEY_HANDLE_PROP_ID, 157if (!Interop.Crypt32.CryptAcquireCertificatePrivateKey( 159Interop.Crypt32.CryptAcquireCertificatePrivateKeyFlags.CRYPT_ACQUIRE_ONLY_NCRYPT_KEY_FLAG, 162out Interop.Crypt32.CryptKeySpec _, 218if (!Interop.Crypt32.CertGetCertificateContextProperty(hCertContext, Interop.Crypt32.CertContextPropId.CERT_KEY_PROV_INFO_PROP_ID, null, ref cbData)) 235if (!Interop.Crypt32.CertGetCertificateContextProperty(hCertContext, Interop.Crypt32.CertContextPropId.CERT_KEY_PROV_INFO_PROP_ID, privateKey, ref cbData)) 237Interop.Crypt32.CRYPT_KEY_PROV_INFO* pKeyProvInfo = (Interop.Crypt32.CRYPT_KEY_PROV_INFO*)pPrivateKey; 245Flags = (pKeyProvInfo->dwFlags & Interop.Crypt32.CryptAcquireContextFlags.CRYPT_MACHINE_KEYSET) == Interop.Crypt32.CryptAcquireContextFlags.CRYPT_MACHINE_KEYSET ? CspProviderFlags.UseMachineKeyStore : 0, 272Interop.Crypt32.CRYPT_KEY_PROV_INFO keyProvInfo = default; 279keyProvInfo.dwFlags = machineKey ? Interop.Crypt32.CryptAcquireContextFlags.CRYPT_MACHINE_KEYSET : 0; 282if (!Interop.Crypt32.CertSetCertificateContextProperty( 284Interop.Crypt32.CertContextPropId.CERT_KEY_PROV_INFO_PROP_ID, 285Interop.Crypt32.CertSetPropertyFlags.None, 313if (!Interop.Crypt32.CertSetCertificateContextProperty( 315Interop.Crypt32.CertContextPropId.CERT_NCRYPT_KEY_HANDLE_PROP_ID, 316Interop.Crypt32.CertSetPropertyFlags.CERT_SET_PROPERTY_INHIBIT_PERSIST_FLAG,
System\Security\Cryptography\AesCcm.Windows.cs (1)
19_keyHandle = Interop.BCrypt.BCryptImportKey(BCryptAeadHandleCache.AesCcm, key);
System\Security\Cryptography\BasicSymmetricCipherLiteBCrypt.cs (3)
37_hKey = Interop.BCrypt.BCryptImportKey(algorithm, key); 86Interop.BCrypt.BCryptEncrypt(_hKey, input, _currentIv, output) : 87Interop.BCrypt.BCryptDecrypt(_hKey, input, _currentIv, output);
System\Security\Cryptography\BasicSymmetricCipherLiteNCrypt.cs (5)
11using AsymmetricPaddingMode = Interop.NCrypt.AsymmetricPaddingMode; 12using ErrorCode = Interop.NCrypt.ErrorCode; 103Interop.NCrypt.NCryptEncrypt(keyHandle, input, input.Length, null, output, output.Length, out bytesWritten, AsymmetricPaddingMode.None) : 104Interop.NCrypt.NCryptDecrypt(keyHandle, input, input.Length, null, output, output.Length, out bytesWritten, AsymmetricPaddingMode.None); 126ErrorCode errorCode = Interop.NCrypt.NCryptSetProperty(
System\Security\Cryptography\CapiHelper.DSA.Windows.cs (1)
34(uint)Interop.Advapi32.CryptAcquireContextFlags.CRYPT_VERIFYCONTEXT))
System\Security\Cryptography\CapiHelper.Windows.cs (74)
11using static Interop.Crypt32; 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)) 1149return global::Interop.Crypt32.FindOidInfo(CryptOidInfoKeyType.CRYPT_OID_INFO_OID_KEY, oid, oidGroup, fallBackToAllGroups: false).AlgId; 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\ChaCha20Poly1305.Windows.cs (1)
19_keyHandle = Interop.BCrypt.BCryptImportKey(BCryptAeadHandleCache.ChaCha20Poly1305, key);
System\Security\Cryptography\CngAlgorithmCore.cs (2)
6using static Interop.NCrypt; 105Interop.BCrypt.BCryptPropertyStrings.BCRYPT_ECC_PARAMETERS,
System\Security\Cryptography\CngAsnFormatter.cs (4)
21int dwFormatStrType = multiLine ? Interop.Crypt32.CRYPT_FORMAT_STR_MULTI_LINE : Interop.Crypt32.CRYPT_FORMAT_STR_NONE; 30if (Interop.Crypt32.CryptFormatObject(X509_ASN_ENCODING, 0, dwFormatStrType, IntPtr.Zero, (byte*)oidValuePtr, rawData, rawData.Length, null, ref cbFormat)) 38if (Interop.Crypt32.CryptFormatObject(X509_ASN_ENCODING, 0, dwFormatStrType, IntPtr.Zero, (byte*)oidValuePtr, rawData, rawData.Length, bufferPtr, ref cbFormat))
System\Security\Cryptography\CngHelpers.cs (20)
10using BCRYPT_RSAKEY_BLOB = Interop.BCrypt.BCRYPT_RSAKEY_BLOB; 11using ErrorCode = Interop.NCrypt.ErrorCode; 12using KeyBlobMagicNumber = Interop.BCrypt.KeyBlobMagicNumber; 18private static readonly CngKeyBlobFormat s_cipherKeyBlobFormat = new CngKeyBlobFormat(Interop.NCrypt.NCRYPT_CIPHER_KEY_BLOB); 41ErrorCode errorCode = Interop.NCrypt.NCryptGetProperty( 81if (ncryptMagic != Interop.NCrypt.NCRYPT_CIPHER_KEY_BLOB_MAGIC) 98if (bcryptMagic != Interop.BCrypt.BCRYPT_KEY_DATA_BLOB_HEADER.BCRYPT_KEY_DATA_BLOB_MAGIC) 102if (dwVersion != Interop.BCrypt.BCRYPT_KEY_DATA_BLOB_HEADER.BCRYPT_KEY_DATA_BLOB_VERSION1) 208Interop.BCrypt.Emit(rsaBlob, ref offset, parameters.Exponent); 209Interop.BCrypt.Emit(rsaBlob, ref offset, parameters.Modulus); 213Interop.BCrypt.Emit(rsaBlob, ref offset, parameters.P!); 214Interop.BCrypt.Emit(rsaBlob, ref offset, parameters.Q!); 262rsaParams.Exponent = Interop.BCrypt.Consume(rsaBlob, ref offset, pBcryptBlob->cbPublicExp); 263rsaParams.Modulus = Interop.BCrypt.Consume(rsaBlob, ref offset, pBcryptBlob->cbModulus); 267rsaParams.P = Interop.BCrypt.Consume(rsaBlob, ref offset, pBcryptBlob->cbPrime1); 268rsaParams.Q = Interop.BCrypt.Consume(rsaBlob, ref offset, pBcryptBlob->cbPrime2); 269rsaParams.DP = Interop.BCrypt.Consume(rsaBlob, ref offset, pBcryptBlob->cbPrime1); 270rsaParams.DQ = Interop.BCrypt.Consume(rsaBlob, ref offset, pBcryptBlob->cbPrime2); 271rsaParams.InverseQ = Interop.BCrypt.Consume(rsaBlob, ref offset, pBcryptBlob->cbPrime1); 272rsaParams.D = Interop.BCrypt.Consume(rsaBlob, ref offset, pBcryptBlob->cbModulus);
System\Security\Cryptography\CngKey.Create.cs (9)
8using ErrorCode = Interop.NCrypt.ErrorCode; 9using NCRYPT_UI_POLICY = Interop.NCrypt.NCRYPT_UI_POLICY; 45ErrorCode errorCode = Interop.NCrypt.NCryptCreatePersistedKey(providerHandle, out keyHandle, algorithm.Algorithm, keyName, 0, creationParameters.KeyCreationOptions); 54errorCode = Interop.NCrypt.NCryptFinalizeKey(keyHandle, 0); 95ErrorCode errorCode = Interop.NCrypt.NCryptSetProperty(keyHandle, KeyPropertyName.KeyUsage, &keyUsage, sizeof(CngKeyUsages), CngPropertyOptions.Persist); 103ErrorCode errorCode = Interop.NCrypt.NCryptSetProperty(keyHandle, KeyPropertyName.ParentWindowHandle, &parentWindowHandle, sizeof(IntPtr), CngPropertyOptions.None); 121ErrorCode errorCode = Interop.NCrypt.NCryptSetProperty(keyHandle, property.Name, pValue, valueLength, property.Options); 149ErrorCode errorCode = Interop.NCrypt.NCryptSetProperty(keyHandle, KeyPropertyName.UIPolicy, &ncryptUiPolicy, sizeof(NCRYPT_UI_POLICY), CngPropertyOptions.Persist); 160ErrorCode errorCode = Interop.NCrypt.NCryptSetProperty(keyHandle, KeyPropertyName.UseContext, pinnedUseContext, useContextByteLength, CngPropertyOptions.Persist);
System\Security\Cryptography\CngKey.Delete.cs (2)
6using ErrorCode = Interop.NCrypt.ErrorCode; 20ErrorCode errorCode = Interop.NCrypt.NCryptDeleteKey(_keyHandle, 0);
System\Security\Cryptography\CngKey.Exists.cs (2)
7using ErrorCode = Interop.NCrypt.ErrorCode; 43ErrorCode errorCode = Interop.NCrypt.NCryptOpenKey(providerHandle, out keyHandle, keyName, 0, options);
System\Security\Cryptography\CngKey.Export.cs (3)
6using ErrorCode = Interop.NCrypt.ErrorCode; 23ErrorCode errorCode = Interop.NCrypt.NCryptExportKey(_keyHandle, IntPtr.Zero, format.Format, IntPtr.Zero, null, 0, out numBytesNeeded, 0); 28errorCode = Interop.NCrypt.NCryptExportKey(_keyHandle, IntPtr.Zero, format.Format, IntPtr.Zero, buffer, buffer.Length, out numBytesNeeded, 0);
System\Security\Cryptography\CngKey.Import.cs (10)
8using ErrorCode = Interop.NCrypt.ErrorCode; 59Interop.NCrypt.NCryptBuffer* buffers = stackalloc Interop.NCrypt.NCryptBuffer[1]; 61buffers[0] = new Interop.NCrypt.NCryptBuffer 63BufferType = Interop.NCrypt.BufferType.PkcsSecret, 73Interop.NCrypt.NCryptBufferDesc desc = new Interop.NCrypt.NCryptBufferDesc 80ErrorCode errorCode = Interop.NCrypt.NCryptImportKey( 83Interop.NCrypt.NCRYPT_PKCS8_PRIVATE_KEY_BLOB, 131errorCode = Interop.NCrypt.NCryptImportKey(
System\Security\Cryptography\CngKey.Open.cs (2)
7using ErrorCode = Interop.NCrypt.ErrorCode; 40ErrorCode errorCode = Interop.NCrypt.NCryptOpenKey(providerHandle, out keyHandle, keyName, 0, openOptions);
System\Security\Cryptography\CngKey.Properties.cs (3)
6using ErrorCode = Interop.NCrypt.ErrorCode; 41ErrorCode errorCode = Interop.NCrypt.NCryptGetProperty(_keyHandle, name, null, 0, out _, options); 65ErrorCode errorCode = Interop.NCrypt.NCryptSetProperty(_keyHandle, property.Name, pinnedPropertyValue, propertyValue.Length, property.Options);
System\Security\Cryptography\CngKey.StandardProperties.cs (9)
8using ErrorCode = Interop.NCrypt.ErrorCode; 9using NCRYPT_UI_POLICY = Interop.NCrypt.NCRYPT_UI_POLICY; 121ErrorCode errorCode = Interop.NCrypt.NCryptGetProperty(_keyHandle, KeyPropertyName.ClrIsEphemeral, &propertyValue, sizeof(byte), out cbResult, CngPropertyOptions.CustomProperty); 145ErrorCode errorCode = Interop.NCrypt.NCryptSetProperty(_keyHandle, KeyPropertyName.ClrIsEphemeral, &isEphemeral, sizeof(byte), CngPropertyOptions.CustomProperty); 205ErrorCode errorCode = Interop.NCrypt.NCryptGetIntProperty( 213errorCode = Interop.NCrypt.NCryptGetIntProperty( 283Interop.NCrypt.NCryptSetProperty(_keyHandle, KeyPropertyName.ParentWindowHandle, &value, IntPtr.Size, CngPropertyOptions.None); 337ErrorCode errorCode = Interop.NCrypt.NCryptGetProperty(_keyHandle, KeyPropertyName.UIPolicy, null, 0, out numBytesNeeded, CngPropertyOptions.None); 362errorCode = Interop.NCrypt.NCryptGetProperty(_keyHandle, KeyPropertyName.UIPolicy, pNcryptUiPolicyAndStrings, ncryptUiPolicyAndStrings.Length, out numBytesNeeded, CngPropertyOptions.None);
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\DSACng.ImportExport.cs (1)
68Interop.NCrypt.NCRYPT_PKCS8_PRIVATE_KEY_BLOB,
System\Security\Cryptography\ECCng.ImportExport.cs (1)
5using static Interop.BCrypt;
System\Security\Cryptography\ECDiffieHellmanCng.cs (1)
224Interop.NCrypt.NCRYPT_PKCS8_PRIVATE_KEY_BLOB,
System\Security\Cryptography\ECDiffieHellmanCng.Derive.cs (7)
52Interop.NCrypt.SecretAgreementFlags flags = 54? Interop.NCrypt.SecretAgreementFlags.UseSecretAsHmacKey 55: Interop.NCrypt.SecretAgreementFlags.None; 62return Interop.NCrypt.DeriveKeyMaterialHash( 69return Interop.NCrypt.DeriveKeyMaterialHmac( 82return Interop.NCrypt.DeriveKeyMaterialTls( 140return Interop.NCrypt.DeriveSecretAgreement(localHandle, otherPartyHandle);
System\Security\Cryptography\ECDsaCng.cs (1)
169Interop.NCrypt.NCRYPT_PKCS8_PRIVATE_KEY_BLOB,
System\Security\Cryptography\HashProviderCng.cs (16)
9using BCryptCreateHashFlags = Interop.BCrypt.BCryptCreateHashFlags; 10using BCryptOpenAlgorithmProviderFlags = Interop.BCrypt.BCryptOpenAlgorithmProviderFlags; 11using NTSTATUS = Interop.BCrypt.NTSTATUS; 38_hAlgorithm = Interop.BCrypt.BCryptAlgorithmCache.GetCachedBCryptAlgorithmHandle(hashAlgId, dwFlags, out _hashSize); 39NTSTATUS ntStatus = Interop.BCrypt.BCryptCreateHash(_hAlgorithm, out _hHash, IntPtr.Zero, 0, key, key.Length, BCryptCreateHashFlags.BCRYPT_HASH_REUSABLE_FLAG); 44throw Interop.BCrypt.CreateCryptographicException(ntStatus); 68NTSTATUS ntStatus = Interop.BCrypt.BCryptHashData(_hHash, source, source.Length, 0); 71throw Interop.BCrypt.CreateCryptographicException(ntStatus); 85NTSTATUS ntStatus = Interop.BCrypt.BCryptFinishHash(_hHash, destination, _hashSize, 0); 89throw Interop.BCrypt.CreateCryptographicException(ntStatus); 105using (SafeBCryptHashHandle tmpHash = Interop.BCrypt.BCryptDuplicateHash(_hHash)) 107NTSTATUS ntStatus = Interop.BCrypt.BCryptFinishHash(tmpHash, destination, _hashSize, 0); 111throw Interop.BCrypt.CreateCryptographicException(ntStatus); 123SafeBCryptHashHandle clone = Interop.BCrypt.BCryptDuplicateHash(_hHash); 159NTSTATUS ntStatus = Interop.BCrypt.BCryptCreateHash(_hAlgorithm, out hHash, IntPtr.Zero, 0, _key, _key == null ? 0 : _key.Length, Flags); 164throw Interop.BCrypt.CreateCryptographicException(ntStatus);
System\Security\Cryptography\HashProviderDispenser.Windows.cs (33)
8using BCryptAlgorithmCache = Interop.BCrypt.BCryptAlgorithmCache; 9using BCryptCreateHashFlags = Interop.BCrypt.BCryptCreateHashFlags; 10using BCryptOpenAlgorithmProviderFlags = Interop.BCrypt.BCryptOpenAlgorithmProviderFlags; 11using NTSTATUS = Interop.BCrypt.NTSTATUS; 121if (Interop.BCrypt.PseudoHandlesSupported) 148Debug.Assert(Interop.BCrypt.PseudoHandlesSupported); 157if (Interop.BCrypt.PseudoHandlesSupported) 194Interop.BCrypt.BCryptAlgPseudoHandle algHandle; 200Interop.BCrypt.BCryptAlgPseudoHandle.BCRYPT_HMAC_MD5_ALG_HANDLE : 201Interop.BCrypt.BCryptAlgPseudoHandle.BCRYPT_MD5_ALG_HANDLE; 207Interop.BCrypt.BCryptAlgPseudoHandle.BCRYPT_HMAC_SHA1_ALG_HANDLE : 208Interop.BCrypt.BCryptAlgPseudoHandle.BCRYPT_SHA1_ALG_HANDLE; 214Interop.BCrypt.BCryptAlgPseudoHandle.BCRYPT_HMAC_SHA256_ALG_HANDLE : 215Interop.BCrypt.BCryptAlgPseudoHandle.BCRYPT_SHA256_ALG_HANDLE; 221Interop.BCrypt.BCryptAlgPseudoHandle.BCRYPT_HMAC_SHA384_ALG_HANDLE : 222Interop.BCrypt.BCryptAlgPseudoHandle.BCRYPT_SHA384_ALG_HANDLE; 228Interop.BCrypt.BCryptAlgPseudoHandle.BCRYPT_HMAC_SHA512_ALG_HANDLE : 229Interop.BCrypt.BCryptAlgPseudoHandle.BCRYPT_SHA512_ALG_HANDLE; 235Interop.BCrypt.BCryptAlgPseudoHandle.BCRYPT_HMAC_SHA3_256_ALG_HANDLE : 236Interop.BCrypt.BCryptAlgPseudoHandle.BCRYPT_SHA3_256_ALG_HANDLE; 242Interop.BCrypt.BCryptAlgPseudoHandle.BCRYPT_HMAC_SHA3_384_ALG_HANDLE : 243Interop.BCrypt.BCryptAlgPseudoHandle.BCRYPT_SHA3_384_ALG_HANDLE; 249Interop.BCrypt.BCryptAlgPseudoHandle.BCRYPT_HMAC_SHA3_512_ALG_HANDLE : 250Interop.BCrypt.BCryptAlgPseudoHandle.BCRYPT_SHA3_512_ALG_HANDLE; 255algHandle = Interop.BCrypt.BCryptAlgPseudoHandle.BCRYPT_CSHAKE128_ALG_HANDLE; 260algHandle = Interop.BCrypt.BCryptAlgPseudoHandle.BCRYPT_CSHAKE256_ALG_HANDLE; 279NTSTATUS ntStatus = Interop.BCrypt.BCryptHash((uint)algHandle, pKey, key.Length, pSrc, source.Length, pDest, digestSizeInBytes); 283throw Interop.BCrypt.CreateCryptographicException(ntStatus); 297NTSTATUS ntStatus = Interop.BCrypt.BCryptCreateHash( 309throw Interop.BCrypt.CreateCryptographicException(ntStatus); 314ntStatus = Interop.BCrypt.BCryptHashData(hHash, source, source.Length, 0); 318throw Interop.BCrypt.CreateCryptographicException(ntStatus); 321Interop.BCrypt.BCryptFinishHash(hHash, destination, hashSize, 0);
System\Security\Cryptography\HKDF.Windows.cs (18)
11using BCryptAlgPseudoHandle = Interop.BCrypt.BCryptAlgPseudoHandle; 12using BCryptBuffer = Interop.BCrypt.BCryptBuffer; 13using BCryptBufferDesc = Interop.BCrypt.BCryptBufferDesc; 14using BCryptOpenAlgorithmProviderFlags = Interop.BCrypt.BCryptOpenAlgorithmProviderFlags; 15using BCRYPT_KEY_DATA_BLOB_HEADER = Interop.BCrypt.BCRYPT_KEY_DATA_BLOB_HEADER; 16using CngBufferDescriptors = Interop.BCrypt.CngBufferDescriptors; 17using NTSTATUS = Interop.BCrypt.NTSTATUS; 102NTSTATUS openStatus = Interop.BCrypt.BCryptOpenAlgorithmProvider( 123Debug.Assert(Interop.BCrypt.PseudoHandlesSupported); 150status = Interop.BCrypt.BCryptGenerateSymmetricKey( 161throw Interop.BCrypt.CreateCryptographicException(status); 164Interop.BCrypt.BCryptSetSZProperty(keyHandle, BCRYPT_HKDF_HASH_ALGORITHM, hashAlgorithmName.Name); 170status = Interop.BCrypt.BCryptSetProperty( 181status = Interop.BCrypt.BCryptSetProperty( 191throw Interop.BCrypt.CreateCryptographicException(status); 204bufferDesc.ulVersion = Interop.BCrypt.BCRYPTBUFFER_VERSION; 208status = Interop.BCrypt.BCryptKeyDerivation( 218throw Interop.BCrypt.CreateCryptographicException(status);
System\Security\Cryptography\LiteHash.Windows.cs (43)
8using BCryptCreateHashFlags = Interop.BCrypt.BCryptCreateHashFlags; 9using BCryptOpenAlgorithmProviderFlags = Interop.BCrypt.BCryptOpenAlgorithmProviderFlags; 10using NTSTATUS = Interop.BCrypt.NTSTATUS; 50HashAlgorithmNames.KMAC128 => (nuint)Interop.BCrypt.BCryptAlgPseudoHandle.BCRYPT_KMAC128_ALG_HANDLE, 51HashAlgorithmNames.KMAC256 => (nuint)Interop.BCrypt.BCryptAlgPseudoHandle.BCRYPT_KMAC256_ALG_HANDLE, 55NTSTATUS ntStatus = Interop.BCrypt.BCryptCreateHash( 67throw Interop.BCrypt.CreateCryptographicException(ntStatus); 82throw Interop.BCrypt.CreateCryptographicException(ntStatus); 117CheckStatus(Interop.BCrypt.BCryptFinishHash(_hashHandle, buffer, 0, dwFlags: 0)); 128CheckStatus(Interop.BCrypt.BCryptHashData(_hashHandle, data, data.Length, dwFlags: 0)); 135using (SafeBCryptHashHandle dup = Interop.BCrypt.BCryptDuplicateHash(_hashHandle)) 137CheckStatus(Interop.BCrypt.BCryptFinishHash(dup, pDestination, destination.Length, _finishFlags)); 148CheckStatus(Interop.BCrypt.BCryptFinishHash(_hashHandle, pDestination, destination.Length, _finishFlags)); 156SafeBCryptHashHandle clone = Interop.BCrypt.BCryptDuplicateHash(_hashHandle); 169throw Interop.BCrypt.CreateCryptographicException(status); 184HashAlgorithmNames.CSHAKE128 => (nuint)Interop.BCrypt.BCryptAlgPseudoHandle.BCRYPT_CSHAKE128_ALG_HANDLE, 185HashAlgorithmNames.CSHAKE256 => (nuint)Interop.BCrypt.BCryptAlgPseudoHandle.BCRYPT_CSHAKE256_ALG_HANDLE, 191NTSTATUS ntStatus = Interop.BCrypt.BCryptCreateHash( 203throw Interop.BCrypt.CreateCryptographicException(ntStatus); 237NTSTATUS ntStatus = Interop.BCrypt.BCryptHashData(_hashHandle, data, data.Length, dwFlags: 0); 241throw Interop.BCrypt.CreateCryptographicException(ntStatus); 249NTSTATUS ntStatus = Interop.BCrypt.BCryptFinishHash(_hashHandle, pDestination, destination.Length, dwFlags: 0); 253throw Interop.BCrypt.CreateCryptographicException(ntStatus); 267using (SafeBCryptHashHandle tmpHash = Interop.BCrypt.BCryptDuplicateHash(_hashHandle)) 270NTSTATUS ntStatus = Interop.BCrypt.BCryptFinishHash(tmpHash, pDestination, destination.Length, dwFlags: 0); 274throw Interop.BCrypt.CreateCryptographicException(ntStatus); 281SafeBCryptHashHandle clone = Interop.BCrypt.BCryptDuplicateHash(_hashHandle); 289NTSTATUS ntStatus = Interop.BCrypt.BCryptFinishHash(_hashHandle, pDestination, destination.Length, dwFlags: BCRYPT_HASH_DONT_RESET_FLAG); 293throw Interop.BCrypt.CreateCryptographicException(ntStatus); 318SafeBCryptAlgorithmHandle algorithmHandle = Interop.BCrypt.BCryptAlgorithmCache.GetCachedBCryptAlgorithmHandle( 325NTSTATUS ntStatus = Interop.BCrypt.BCryptCreateHash( 337throw Interop.BCrypt.CreateCryptographicException(ntStatus); 350NTSTATUS ntStatus = Interop.BCrypt.BCryptHashData(_hashHandle, data, data.Length, dwFlags: 0); 354throw Interop.BCrypt.CreateCryptographicException(ntStatus); 362NTSTATUS ntStatus = Interop.BCrypt.BCryptFinishHash(_hashHandle, destination, _hashSizeInBytes, dwFlags: 0); 366throw Interop.BCrypt.CreateCryptographicException(ntStatus); 391SafeBCryptAlgorithmHandle algorithmHandle = Interop.BCrypt.BCryptAlgorithmCache.GetCachedBCryptAlgorithmHandle( 398NTSTATUS ntStatus = Interop.BCrypt.BCryptCreateHash( 410throw Interop.BCrypt.CreateCryptographicException(ntStatus); 423NTSTATUS ntStatus = Interop.BCrypt.BCryptHashData(_hashHandle, data, data.Length, dwFlags: 0); 427throw Interop.BCrypt.CreateCryptographicException(ntStatus); 435NTSTATUS ntStatus = Interop.BCrypt.BCryptFinishHash(_hashHandle, destination, _hashSizeInBytes, dwFlags: 0); 439throw Interop.BCrypt.CreateCryptographicException(ntStatus);
System\Security\Cryptography\OidLookup.Windows.cs (3)
4using static Interop.Crypt32; 17CRYPT_OID_INFO oidInfo = Interop.Crypt32.FindOidInfo(CryptOidInfoKeyType.CRYPT_OID_INFO_OID_KEY, oid, oidGroup, fallBackToAllGroups); 23CRYPT_OID_INFO oidInfo = Interop.Crypt32.FindOidInfo(CryptOidInfoKeyType.CRYPT_OID_INFO_NAME_KEY, friendlyName, oidGroup, fallBackToAllGroups);
System\Security\Cryptography\Pbkdf2Implementation.Windows.cs (15)
7using BCryptAlgPseudoHandle = Interop.BCrypt.BCryptAlgPseudoHandle; 8using BCryptBuffer = Interop.BCrypt.BCryptBuffer; 9using BCryptOpenAlgorithmProviderFlags = Interop.BCrypt.BCryptOpenAlgorithmProviderFlags; 10using CngBufferDescriptors = Interop.BCrypt.CngBufferDescriptors; 11using NTSTATUS = Interop.BCrypt.NTSTATUS; 90if (Interop.BCrypt.PseudoHandlesSupported) 94generateKeyStatus = Interop.BCrypt.BCryptGenerateSymmetricKey( 108NTSTATUS openStatus = Interop.BCrypt.BCryptOpenAlgorithmProvider( 118throw Interop.BCrypt.CreateCryptographicException(openStatus); 128generateKeyStatus = Interop.BCrypt.BCryptGenerateSymmetricKey( 144throw Interop.BCrypt.CreateCryptographicException(generateKeyStatus); 173Interop.BCrypt.BCryptBufferDesc bufferDesc; 174bufferDesc.ulVersion = Interop.BCrypt.BCRYPTBUFFER_VERSION; 178NTSTATUS deriveStatus = Interop.BCrypt.BCryptKeyDerivation( 188throw Interop.BCrypt.CreateCryptographicException(deriveStatus);
System\Security\Cryptography\RandomNumberGeneratorImplementation.Windows.cs (5)
14Interop.BCrypt.NTSTATUS status = Interop.BCrypt.BCryptGenRandom(IntPtr.Zero, pbBuffer, count, Interop.BCrypt.BCRYPT_USE_SYSTEM_PREFERRED_RNG); 15if (status != Interop.BCrypt.NTSTATUS.STATUS_SUCCESS) 16throw Interop.BCrypt.CreateCryptographicException(status);
System\Security\Cryptography\RSABCrypt.cs (23)
14Interop.BCrypt.BCryptOpenAlgorithmProvider(BCryptNative.AlgorithmName.RSA); 53SafeBCryptKeyHandle newKey = Interop.BCrypt.BCryptGenerateKeyPair(s_algHandle, keySize); 54Interop.BCrypt.BCryptFinalizeKeyPair(newKey); 63int keySize = Interop.BCrypt.BCryptGetDWordProperty( 65Interop.BCrypt.BCryptPropertyStrings.BCRYPT_KEY_STRENGTH); 77ArraySegment<byte> keyBlob = Interop.BCrypt.BCryptExportKey( 80Interop.BCrypt.KeyBlobType.BCRYPT_RSAFULLPRIVATE_BLOB : 81Interop.BCrypt.KeyBlobType.BCRYPT_RSAPUBLIC_KEY_BLOB); 103newKey = Interop.BCrypt.BCryptImportKeyPair( 106Interop.BCrypt.KeyBlobType.BCRYPT_RSAPRIVATE_BLOB : 107Interop.BCrypt.KeyBlobType.BCRYPT_RSAPUBLIC_KEY_BLOB, 200return Interop.BCrypt.BCryptDecryptPkcs1(key, data, destination, out bytesWritten); 202return Interop.BCrypt.BCryptDecryptOaep( 243bytesWritten = Interop.BCrypt.BCryptEncryptPkcs1(key, data, destination); 246bytesWritten = Interop.BCrypt.BCryptEncryptOaep( 277Interop.BCrypt.NTSTATUS status; 283status = Interop.BCrypt.BCryptSignHashPkcs1( 292status = Interop.BCrypt.BCryptSignHashPss( 304if (status == Interop.BCrypt.NTSTATUS.STATUS_SUCCESS) 310if (status == Interop.BCrypt.NTSTATUS.STATUS_BUFFER_TOO_SMALL) 316throw Interop.BCrypt.CreateCryptographicException(status); 339return Interop.BCrypt.BCryptVerifySignaturePkcs1( 345return Interop.BCrypt.BCryptVerifySignaturePss(
System\Security\Cryptography\RSACng.ImportExport.cs (4)
10new CngKeyBlobFormat(Interop.BCrypt.KeyBlobType.BCRYPT_RSAFULLPRIVATE_BLOB); 13new CngKeyBlobFormat(Interop.BCrypt.KeyBlobType.BCRYPT_RSAPRIVATE_BLOB); 16new CngKeyBlobFormat(Interop.BCrypt.KeyBlobType.BCRYPT_RSAPUBLIC_KEY_BLOB); 70Interop.NCrypt.NCRYPT_PKCS8_PRIVATE_KEY_BLOB,
System\Security\Cryptography\RSACryptoServiceProvider.Windows.cs (1)
666if (_parameters.KeyNumber == (int)Interop.Advapi32.KeySpec.AT_KEYEXCHANGE)
System\Security\Cryptography\X509Certificates\CertificateHelpers.Windows.cs (1)
180return Interop.Crypt32.CertDuplicateCertificateContext(handle.DangerousGetHandle());
System\Security\Cryptography\X509Certificates\CertificatePal.Windows.cs (63)
24SafeCertContextHandle safeCertContextHandle = Interop.Crypt32.CertDuplicateCertificateContext(handle); 33bool deleteKeyContainer = Interop.Crypt32.CertGetCertificateContextProperty(safeCertContextHandle, Interop.Crypt32.CertContextPropId.CERT_CLR_DELETE_KEY_PROP_ID, out Interop.Crypt32.DATA_BLOB _, ref cbData); 68if (!Interop.Crypt32.CertGetCertificateContextProperty(_certContext, Interop.Crypt32.CertContextPropId.CERT_SHA1_HASH_PROP_ID, null, ref cbData)) 72if (!Interop.Crypt32.CertGetCertificateContextProperty(_certContext, Interop.Crypt32.CertContextPropId.CERT_SHA1_HASH_PROP_ID, thumbprint, ref cbData)) 106algId = Interop.Crypt32.FindOidInfo(Interop.Crypt32.CryptOidInfoKeyType.CRYPT_OID_INFO_OID_KEY, keyAlgorithmOid, OidGroup.PublicKeyAlgorithm, fallBackToAllGroups: true).AlgId; 126Interop.Crypt32.DATA_BLOB parametersBlob = pCertContext->pCertInfo->SubjectPublicKeyInfo.Algorithm.Parameters; 153if (!Interop.Crypt32.CertGetCertificateContextProperty(_certContext, Interop.Crypt32.CertContextPropId.CERT_PUBKEY_ALG_PARA_PROP_ID, null, ref cbData)) 155Interop.Crypt32.CERT_CHAIN_PARA chainPara = default; 156chainPara.cbSize = sizeof(Interop.Crypt32.CERT_CHAIN_PARA); 157if (!Interop.Crypt32.CertGetCertificateChain((IntPtr)Interop.Crypt32.ChainEngine.HCCE_CURRENT_USER, _certContext, null, SafeCertStoreHandle.InvalidHandle, ref chainPara, Interop.Crypt32.CertChainFlags.None, IntPtr.Zero, out certChainContext)) 159if (!Interop.Crypt32.CertGetCertificateContextProperty(_certContext, Interop.Crypt32.CertContextPropId.CERT_PUBKEY_ALG_PARA_PROP_ID, null, ref cbData)) 164if (!Interop.Crypt32.CertGetCertificateContextProperty(_certContext, Interop.Crypt32.CertContextPropId.CERT_PUBKEY_ALG_PARA_PROP_ID, keyAlgorithmParameters, ref cbData)) 272bool archivePropertyExists = Interop.Crypt32.CertGetCertificateContextProperty(_certContext, Interop.Crypt32.CertContextPropId.CERT_ARCHIVED_PROP_ID, null!, ref uninteresting); 280Interop.Crypt32.DATA_BLOB blob = new Interop.Crypt32.DATA_BLOB(IntPtr.Zero, 0); 281Interop.Crypt32.DATA_BLOB* pValue = value ? &blob : (Interop.Crypt32.DATA_BLOB*)null; 282if (!Interop.Crypt32.CertSetCertificateContextProperty(_certContext, Interop.Crypt32.CertContextPropId.CERT_ARCHIVED_PROP_ID, Interop.Crypt32.CertSetPropertyFlags.None, pValue)) 295if (!Interop.Crypt32.CertGetCertificateContextPropertyString(_certContext, Interop.Crypt32.CertContextPropId.CERT_FRIENDLY_NAME_PROP_ID, null, ref cbData)) 304if (!Interop.Crypt32.CertGetCertificateContextPropertyString(_certContext, Interop.Crypt32.CertContextPropId.CERT_FRIENDLY_NAME_PROP_ID, (byte*)ptr, ref cbData)) 320Interop.Crypt32.DATA_BLOB blob = new Interop.Crypt32.DATA_BLOB(pFriendlyName, checked(2 * ((uint)friendlyName.Length + 1))); 321if (!Interop.Crypt32.CertSetCertificateContextProperty(_certContext, Interop.Crypt32.CertContextPropId.CERT_FRIENDLY_NAME_PROP_ID, Interop.Crypt32.CertSetPropertyFlags.None, &blob)) 377Interop.Crypt32.CERT_INFO* pCertInfo = certContext->pCertInfo; 383Interop.Crypt32.CERT_EXTENSION* pCertExtension = (Interop.Crypt32.CERT_EXTENSION*)pCertInfo->rgExtension.ToPointer() + i; 400Interop.crypt32.CertGetNameString( 403forIssuer ? Interop.Crypt32.CertNameFlags.CERT_NAME_ISSUER_FLAG : Interop.Crypt32.CertNameFlags.None, 404Interop.Crypt32.CertNameStringType.CERT_X500_NAME_STR | Interop.Crypt32.CertNameStringType.CERT_NAME_STR_REVERSE_FLAG); 490return Interop.Crypt32.CertDuplicateCertificateContext((IntPtr)certContext); 495private static Interop.Crypt32.CertNameType MapNameType(X509NameType nameType) 500return Interop.Crypt32.CertNameType.CERT_NAME_SIMPLE_DISPLAY_TYPE; 503return Interop.Crypt32.CertNameType.CERT_NAME_EMAIL_TYPE; 506return Interop.Crypt32.CertNameType.CERT_NAME_UPN_TYPE; 510return Interop.Crypt32.CertNameType.CERT_NAME_DNS_TYPE; 513return Interop.Crypt32.CertNameType.CERT_NAME_URL_TYPE; 521Interop.crypt32.CertGetNameString( 523Interop.Crypt32.CertNameType.CERT_NAME_RDN_TYPE, 524issuer ? Interop.Crypt32.CertNameFlags.CERT_NAME_ISSUER_FLAG : Interop.Crypt32.CertNameFlags.None, 525Interop.Crypt32.CertNameStringType.CERT_X500_NAME_STR | (reverse ? Interop.Crypt32.CertNameStringType.CERT_NAME_STR_REVERSE_FLAG : 0)); 542certContext = Interop.Crypt32.CertDuplicateCertificateContextWithKeyContainerDeletion(oldCertContext.DangerousGetHandle()); 592private unsafe delegate T CertContextCallback<T>(Interop.Crypt32.CERT_CONTEXT* certContext);
System\Security\Cryptography\X509Certificates\CertificatePal.Windows.Import.cs (28)
31Interop.Crypt32.ContentType contentType; 44Interop.Crypt32.DATA_BLOB certBlob = new Interop.Crypt32.DATA_BLOB(new IntPtr(pRawData), (uint)(loadFromFile ? 0 : rawData.Length)); 46Interop.Crypt32.CertQueryObjectType objectType = loadFromFile ? Interop.Crypt32.CertQueryObjectType.CERT_QUERY_OBJECT_FILE : Interop.Crypt32.CertQueryObjectType.CERT_QUERY_OBJECT_BLOB; 49bool success = Interop.Crypt32.CryptQueryObject( 70if (contentType == Interop.Crypt32.ContentType.CERT_QUERY_CONTENT_PKCS7_SIGNED || contentType == Interop.Crypt32.ContentType.CERT_QUERY_CONTENT_PKCS7_SIGNED_EMBED) 75else if (contentType == Interop.Crypt32.ContentType.CERT_QUERY_CONTENT_PFX) 126if (!Interop.Crypt32.CryptMsgGetParam(hCryptMsg, Interop.Crypt32.CryptMsgParamType.CMSG_SIGNER_COUNT_PARAM, 0, out dwSigners, ref cbSigners)) 133if (!Interop.Crypt32.CryptMsgGetParam(hCryptMsg, Interop.Crypt32.CryptMsgParamType.CMSG_SIGNER_INFO_PARAM, 0, default(byte*), ref cbData)) 138if (!Interop.Crypt32.CryptMsgGetParam(hCryptMsg, Interop.Crypt32.CryptMsgParamType.CMSG_SIGNER_INFO_PARAM, 0, pCmsgSignerBytes, ref cbData)) 143Interop.Crypt32.CERT_INFO certInfo = default(Interop.Crypt32.CERT_INFO); 150if (!Interop.crypt32.CertFindCertificateInStore(hCertStore, Interop.Crypt32.CertFindType.CERT_FIND_SUBJECT_CERT, &certInfo, ref pCertContext)) 161private const Interop.Crypt32.ExpectedContentTypeFlags X509ExpectedContentTypeFlags = 162Interop.Crypt32.ExpectedContentTypeFlags.CERT_QUERY_CONTENT_FLAG_CERT | 163Interop.Crypt32.ExpectedContentTypeFlags.CERT_QUERY_CONTENT_FLAG_SERIALIZED_CERT | 164Interop.Crypt32.ExpectedContentTypeFlags.CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED | 165Interop.Crypt32.ExpectedContentTypeFlags.CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED_EMBED | 166Interop.Crypt32.ExpectedContentTypeFlags.CERT_QUERY_CONTENT_FLAG_PFX; 168private const Interop.Crypt32.ExpectedFormatTypeFlags X509ExpectedFormatTypeFlags = Interop.Crypt32.ExpectedFormatTypeFlags.CERT_QUERY_FORMAT_FLAG_ALL;
System\Security\Cryptography\X509Certificates\CertificatePal.Windows.PrivateKey.cs (5)
259Interop.Crypt32.CRYPT_KEY_PROV_INFO keyProvInfo = default; 266keyProvInfo.dwFlags = keyContainerInfo.MachineKeyStore ? Interop.Crypt32.CryptAcquireContextFlags.CRYPT_MACHINE_KEYSET : 0; 270if (!Interop.Crypt32.CertSetCertificateContextProperty( 272Interop.Crypt32.CertContextPropId.CERT_KEY_PROV_INFO_PROP_ID, 273Interop.Crypt32.CertSetPropertyFlags.None,
System\Security\Cryptography\X509Certificates\ChainPal.Windows.BuildChain.cs (21)
38Interop.Crypt32.CERT_CHAIN_PARA chainPara = default; 39chainPara.cbSize = sizeof(Interop.Crypt32.CERT_CHAIN_PARA); 46chainPara.RequestedUsage.dwType = Interop.Crypt32.CertUsageMatchType.USAGE_MATCH_TYPE_AND; 56chainPara.RequestedIssuancePolicy.dwType = Interop.Crypt32.CertUsageMatchType.USAGE_MATCH_TYPE_AND; 63Interop.Crypt32.FILETIME ft = Interop.Crypt32.FILETIME.FromDateTime(verificationTime); 64Interop.Crypt32.CertChainFlags flags = MapRevocationFlags(revocationMode, revocationFlag, disableAia); 68if (!Interop.Crypt32.CertGetCertificateChain(storeHandle.DangerousGetHandle(), certContext, &ft, extraStoreHandle, ref chainPara, flags, IntPtr.Zero, out chain)) 95Interop.Crypt32.CERT_CHAIN_ENGINE_CONFIG customChainEngine = default; 96customChainEngine.cbSize = sizeof(Interop.Crypt32.CERT_CHAIN_ENGINE_CONFIG); 98chainEngineHandle = Interop.crypt32.CertCreateCertificateChainEngine(ref customChainEngine); 118private static Interop.Crypt32.CertChainFlags MapRevocationFlags( 123const Interop.Crypt32.CertChainFlags AiaDisabledFlags = 124Interop.Crypt32.CertChainFlags.CERT_CHAIN_DISABLE_AIA | Interop.Crypt32.CertChainFlags.CERT_CHAIN_DISABLE_AUTH_ROOT_AUTO_UPDATE; 126Interop.Crypt32.CertChainFlags dwFlags = disableAia ? AiaDisabledFlags : Interop.Crypt32.CertChainFlags.None; 132dwFlags |= Interop.Crypt32.CertChainFlags.CERT_CHAIN_REVOCATION_CHECK_CACHE_ONLY; 135dwFlags |= Interop.Crypt32.CertChainFlags.CERT_CHAIN_REVOCATION_CHECK_END_CERT; 137dwFlags |= Interop.Crypt32.CertChainFlags.CERT_CHAIN_REVOCATION_CHECK_CHAIN; 139dwFlags |= Interop.Crypt32.CertChainFlags.CERT_CHAIN_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT;
System\Security\Cryptography\X509Certificates\ChainPal.Windows.cs (7)
26SafeX509ChainHandle certChainHandle = Interop.Crypt32.CertDuplicateCertificateChain(chainContext); 46Interop.Crypt32.CERT_CHAIN_POLICY_PARA para = default; 47para.cbSize = (uint)sizeof(Interop.Crypt32.CERT_CHAIN_POLICY_PARA); 50Interop.Crypt32.CERT_CHAIN_POLICY_STATUS status = default; 51status.cbSize = (uint)sizeof(Interop.Crypt32.CERT_CHAIN_POLICY_STATUS); 53if (!Interop.crypt32.CertVerifyCertificateChainPolicy(ChainPolicy.CERT_CHAIN_POLICY_BASE, _chain, ref para, ref status)) 115Interop.Crypt32.CertFreeCertificateChain(handle);
System\Security\Cryptography\X509Certificates\ChainPal.Windows.GetChainStatusInformation.cs (1)
64Message = Interop.Kernel32.GetMessage(win32ErrorCode);
System\Security\Cryptography\X509Certificates\FindPal.Windows.cs (51)
32string? oidValue = Interop.Crypt32.FindOidInfo(Interop.Crypt32.CryptOidInfoKeyType.CRYPT_OID_INFO_NAME_KEY, maybeOid, expectedGroup, fallBackToAllGroups: true).OID; 47Interop.Crypt32.DATA_BLOB blob = new Interop.Crypt32.DATA_BLOB(new IntPtr(pThumbPrint), (uint)thumbPrint.Length); 48FindCore<object>(Interop.Crypt32.CertFindType.CERT_FIND_HASH, &blob); 56FindCore<object>(Interop.Crypt32.CertFindType.CERT_FIND_SUBJECT_STR, pSubjectName); 66string actual = GetCertNameInfo(pCertContext, Interop.Crypt32.CertNameType.CERT_NAME_RDN_TYPE, Interop.Crypt32.CertNameFlags.None); 75FindCore<object>(Interop.Crypt32.CertFindType.CERT_FIND_ISSUER_STR, pIssuerName); 85string actual = GetCertNameInfo(pCertContext, Interop.Crypt32.CertNameType.CERT_NAME_RDN_TYPE, Interop.Crypt32.CertNameFlags.CERT_NAME_ISSUER_FLAG); 116Interop.Crypt32.FILETIME fileTime = Interop.Crypt32.FILETIME.FromDateTime(dateTime); 122int comparison = Interop.Crypt32.CertVerifyTimeValidity( 146string expectedOidValue = Interop.Crypt32.FindOidInfo( 147Interop.Crypt32.CryptOidInfoKeyType.CRYPT_OID_INFO_NAME_KEY, 166Interop.Crypt32.CERT_INFO* pCertInfo = pCertContext.DangerousCertContext->pCertInfo; 167Interop.Crypt32.CERT_EXTENSION* pV1Template = Interop.Crypt32.CertFindExtension( 188Interop.Crypt32.CERT_EXTENSION* pV2Template = Interop.Crypt32.CertFindExtension( 221if (!Interop.Crypt32.CertGetValidUsages(1, ref pCertContext, out numOids, null, ref cbData)) 234if (!Interop.Crypt32.CertGetValidUsages(1, ref pCertContext, out numOids, pOidsPointer, ref cbData)) 280Interop.Crypt32.CERT_INFO* pCertInfo = pCertContext.DangerousCertContext->pCertInfo; 281Interop.Crypt32.CERT_EXTENSION* pCertExtension = Interop.Crypt32.CertFindExtension( 310Interop.Crypt32.CERT_INFO* pCertInfo = pCertContext.DangerousCertContext->pCertInfo; 311Interop.Crypt32.CERT_EXTENSION* pCertExtension = Interop.Crypt32.CertFindExtension(oidValue, pCertInfo->cExtension, pCertInfo->rgExtension); 323Interop.Crypt32.CERT_INFO* pCertInfo = pCertContext.DangerousCertContext->pCertInfo; 326if (!Interop.crypt32.CertGetIntendedKeyUsage(Interop.Crypt32.CertEncodingType.All, pCertInfo, out actual, sizeof(X509KeyUsageFlags))) 346if (!Interop.Crypt32.CertGetCertificateContextPropertyPtr( 348Interop.Crypt32.CertContextPropId.CERT_KEY_IDENTIFIER_PROP_ID, 366if (!Interop.Crypt32.CertGetCertificateContextPropertyPtr( 368Interop.Crypt32.CertContextPropId.CERT_KEY_IDENTIFIER_PROP_ID, 388FindCore(Interop.Crypt32.CertFindType.CERT_FIND_ANY, null, state, filter); 391private unsafe void FindCore<TState>(Interop.Crypt32.CertFindType dwFindType, void* pvFindPara, TState state = default!, Func<TState, SafeCertContextHandle, bool>? filter = null) 393SafeCertStoreHandle findResults = Interop.crypt32.CertOpenStore( 395Interop.Crypt32.CertEncodingType.All, 397Interop.Crypt32.CertStoreFlags.CERT_STORE_ENUM_ARCHIVED_FLAG | Interop.Crypt32.CertStoreFlags.CERT_STORE_CREATE_NEW_FLAG, 409while (Interop.crypt32.CertFindCertificateInStore(_storePal.SafeCertStoreHandle, dwFindType, pvFindPara, ref pCertContext)) 424if (!Interop.Crypt32.CertAddCertificateLinkToStore(findResults, pCertContext, Interop.Crypt32.CertStoreAddDisposition.CERT_STORE_ADD_ALWAYS, IntPtr.Zero)) 473private static string GetCertNameInfo(SafeCertContextHandle pCertContext, Interop.Crypt32.CertNameType dwNameType, Interop.Crypt32.CertNameFlags dwNameFlags) 475Debug.Assert(dwNameType != Interop.Crypt32.CertNameType.CERT_NAME_ATTR_TYPE); 476return Interop.crypt32.CertGetNameString( 480Interop.Crypt32.CertNameStringType.CERT_X500_NAME_STR | Interop.Crypt32.CertNameStringType.CERT_NAME_STR_REVERSE_FLAG);
System\Security\Cryptography\X509Certificates\StorePal.Windows.cs (9)
22SafeCertStoreHandle certStoreHandle = Interop.Crypt32.CertDuplicateStore(storeHandle); 43while (Interop.crypt32.CertEnumCertificatesInStore(_certStore, ref pCertContext)) 54if (!Interop.Crypt32.CertAddCertificateContextToStore(_certStore, certContext, Interop.Crypt32.CertStoreAddDisposition.CERT_STORE_ADD_REPLACE_EXISTING_INHERIT_PROPERTIES, IntPtr.Zero)) 66Interop.Crypt32.CERT_CONTEXT* pCertContext = existingCertContext.DangerousCertContext; 67if (!Interop.crypt32.CertFindCertificateInStore(_certStore, Interop.Crypt32.CertFindType.CERT_FIND_EXISTING, pCertContext, ref enumCertContext)) 70Interop.Crypt32.CERT_CONTEXT* pCertContextToDelete = enumCertContext.Disconnect(); // CertDeleteCertificateFromContext always frees the context (even on error) 73if (!Interop.Crypt32.CertDeleteCertificateFromStore(pCertContextToDelete))
System\Security\Cryptography\X509Certificates\StorePal.Windows.Export.cs (26)
33if (!Interop.crypt32.CertEnumCertificatesInStore(_certStore, ref pCertContext)) 56if (!Interop.crypt32.CertEnumCertificatesInStore(_certStore, ref pCertContext)) 62if (!Interop.Crypt32.CertSerializeCertificateStoreElement(pCertContext, 0, null, ref cbEncoded)) 66if (!Interop.Crypt32.CertSerializeCertificateStoreElement(pCertContext, 0, pbEncoded, ref cbEncoded)) 81return SaveToMemoryStore(Interop.Crypt32.CertStoreSaveAs.CERT_STORE_SAVE_AS_STORE); 84return SaveToMemoryStore(Interop.Crypt32.CertStoreSaveAs.CERT_STORE_SAVE_AS_PKCS7); 104Interop.Crypt32.DATA_BLOB dataBlob = new Interop.Crypt32.DATA_BLOB(IntPtr.Zero, 0); 105Interop.Crypt32.PFXExportFlags flags = 106Interop.Crypt32.PFXExportFlags.EXPORT_PRIVATE_KEYS | 107Interop.Crypt32.PFXExportFlags.REPORT_NOT_ABLE_TO_EXPORT_PRIVATE_KEY; 109Interop.Crypt32.PKCS12_PBES2_EXPORT_PARAMS* exportParams = null; 113Interop.Crypt32.PKCS12_PBES2_EXPORT_PARAMS specifiedParams = new() 115dwSize = (uint)sizeof(Interop.Crypt32.PKCS12_PBES2_EXPORT_PARAMS), 124flags |= Interop.Crypt32.PFXExportFlags.PKCS12_EXPORT_PBES2_PARAMS; 143if (!Interop.Crypt32.PFXExportCertStoreEx(_certStore, ref dataBlob, password, exportParams, flags)) 154if (!Interop.Crypt32.PFXExportCertStoreEx(_certStore, ref dataBlob, password, exportParams, flags)) 251private byte[] SaveToMemoryStore(Interop.Crypt32.CertStoreSaveAs dwSaveAs) 255Interop.Crypt32.DATA_BLOB blob = new Interop.Crypt32.DATA_BLOB(IntPtr.Zero, 0); 256if (!Interop.Crypt32.CertSaveStore(_certStore, Interop.Crypt32.CertEncodingType.All, dwSaveAs, Interop.Crypt32.CertStoreSaveTo.CERT_STORE_SAVE_TO_MEMORY, ref blob, 0)) 263if (!Interop.Crypt32.CertSaveStore(_certStore, Interop.Crypt32.CertEncodingType.All, dwSaveAs, Interop.Crypt32.CertStoreSaveTo.CERT_STORE_SAVE_TO_MEMORY, ref blob, 0))
System\Security\Cryptography\X509Certificates\StorePal.Windows.Import.cs (43)
35Interop.Crypt32.DATA_BLOB blob = new Interop.Crypt32.DATA_BLOB(new IntPtr(pRawData), (uint)(fromFile ? 0 : rawData!.Length)); 38Interop.Crypt32.ContentType contentType; 40if (!Interop.Crypt32.CryptQueryObject( 41fromFile ? Interop.Crypt32.CertQueryObjectType.CERT_QUERY_OBJECT_FILE : Interop.Crypt32.CertQueryObjectType.CERT_QUERY_OBJECT_BLOB, 44Interop.Crypt32.ExpectedFormatTypeFlags.CERT_QUERY_FORMAT_FLAG_ALL, 59if (contentType == Interop.Crypt32.ContentType.CERT_QUERY_CONTENT_PFX) 124SafeCertStoreHandle certStore = Interop.crypt32.CertOpenStore( 126Interop.Crypt32.CertEncodingType.All, 128Interop.Crypt32.CertStoreFlags.CERT_STORE_ENUM_ARCHIVED_FLAG | Interop.Crypt32.CertStoreFlags.CERT_STORE_CREATE_NEW_FLAG | Interop.Crypt32.CertStoreFlags.CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG, 134!Interop.Crypt32.CertAddCertificateLinkToStore(certStore, certContext, Interop.Crypt32.CertStoreAddDisposition.CERT_STORE_ADD_ALWAYS, IntPtr.Zero)) 154SafeCertStoreHandle certStore = Interop.crypt32.CertOpenStore( 156Interop.Crypt32.CertEncodingType.All, 158Interop.Crypt32.CertStoreFlags.CERT_STORE_ENUM_ARCHIVED_FLAG | Interop.Crypt32.CertStoreFlags.CERT_STORE_CREATE_NEW_FLAG, 176if (!Interop.Crypt32.CertAddCertificateLinkToStore(certStore, certContext, Interop.Crypt32.CertStoreAddDisposition.CERT_STORE_ADD_ALWAYS, IntPtr.Zero)) 194Interop.Crypt32.CertStoreFlags certStoreFlags = MapX509StoreFlags(storeLocation, openFlags); 196SafeCertStoreHandle certStore = Interop.crypt32.CertOpenStore(CertStoreProvider.CERT_STORE_PROV_SYSTEM_W, Interop.Crypt32.CertEncodingType.All, IntPtr.Zero, certStoreFlags, storeName); 210_ = Interop.Crypt32.CertControlStore(certStore, Interop.Crypt32.CertControlStoreFlags.None, Interop.Crypt32.CertControlStoreType.CERT_STORE_CTRL_AUTO_RESYNC, IntPtr.Zero); 216private static Interop.Crypt32.CertStoreFlags MapX509StoreFlags(StoreLocation storeLocation, OpenFlags flags) 218Interop.Crypt32.CertStoreFlags dwFlags = 0; 223dwFlags |= Interop.Crypt32.CertStoreFlags.CERT_STORE_READONLY_FLAG; 226dwFlags |= Interop.Crypt32.CertStoreFlags.CERT_STORE_MAXIMUM_ALLOWED_FLAG; 231dwFlags |= Interop.Crypt32.CertStoreFlags.CERT_STORE_OPEN_EXISTING_FLAG; 233dwFlags |= Interop.Crypt32.CertStoreFlags.CERT_STORE_ENUM_ARCHIVED_FLAG; 236dwFlags |= Interop.Crypt32.CertStoreFlags.CERT_SYSTEM_STORE_LOCAL_MACHINE; 238dwFlags |= Interop.Crypt32.CertStoreFlags.CERT_SYSTEM_STORE_CURRENT_USER; 243private const Interop.Crypt32.ExpectedContentTypeFlags StoreExpectedContentFlags = 244Interop.Crypt32.ExpectedContentTypeFlags.CERT_QUERY_CONTENT_FLAG_CERT | 245Interop.Crypt32.ExpectedContentTypeFlags.CERT_QUERY_CONTENT_FLAG_SERIALIZED_CERT | 246Interop.Crypt32.ExpectedContentTypeFlags.CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED | 247Interop.Crypt32.ExpectedContentTypeFlags.CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED_EMBED | 248Interop.Crypt32.ExpectedContentTypeFlags.CERT_QUERY_CONTENT_FLAG_PKCS7_UNSIGNED | 249Interop.Crypt32.ExpectedContentTypeFlags.CERT_QUERY_CONTENT_FLAG_PFX | 250Interop.Crypt32.ExpectedContentTypeFlags.CERT_QUERY_CONTENT_FLAG_SERIALIZED_STORE;
System\Security\Cryptography\X509Certificates\WindowsHelpers.cs (18)
85if (!Interop.crypt32.CryptDecodeObjectPointer( 86Interop.Crypt32.CertEncodingType.All, 90Interop.Crypt32.CryptDecodeObjectFlags.None, 107if (!Interop.crypt32.CryptDecodeObjectPointer( 108Interop.Crypt32.CertEncodingType.All, 112Interop.Crypt32.CryptDecodeObjectFlags.None, 131if (!Interop.Crypt32.CryptDecodeObjectPointer( 132Interop.Crypt32.CertEncodingType.All, 136Interop.Crypt32.CryptDecodeObjectFlags.None, 153if (!Interop.Crypt32.CryptDecodeObjectPointer( 154Interop.Crypt32.CertEncodingType.All, 158Interop.Crypt32.CryptDecodeObjectFlags.None, 178if (!Interop.crypt32.CryptDecodeObjectPointer( 179Interop.Crypt32.CertEncodingType.All, 182Interop.Crypt32.CryptDecodeObjectFlags.None, 200if (!Interop.crypt32.CryptDecodeObjectPointer( 201Interop.Crypt32.CertEncodingType.All, 204Interop.Crypt32.CryptDecodeObjectFlags.None,
System\Security\Cryptography\X509Certificates\WindowsInterop.crypt32.cs (42)
22Interop.Crypt32.CertNameType certNameType, 23Interop.Crypt32.CertNameFlags certNameFlags, 24Interop.Crypt32.CertNameStringType strType) 45public static SafeCertStoreHandle CertOpenStore(CertStoreProvider lpszStoreProvider, Interop.Crypt32.CertEncodingType dwMsgAndCertEncodingType, IntPtr hCryptProv, Interop.Crypt32.CertStoreFlags dwFlags, string? pvPara) 59Interop.Crypt32.CERT_CONTEXT* pPrevCertContext; 81public static bool CryptDecodeObject(Interop.Crypt32.CertEncodingType dwCertEncodingType, CryptDecodeObjectStructType lpszStructType, byte[] pbEncoded, int cbEncoded, Interop.Crypt32.CryptDecodeObjectFlags dwFlags, byte[]? pvStructInfo, ref int pcbStructInfo) 83return Interop.Crypt32.CryptDecodeObject(dwCertEncodingType, (IntPtr)lpszStructType, pbEncoded, cbEncoded, dwFlags, pvStructInfo, ref pcbStructInfo); 86public static unsafe bool CryptDecodeObjectPointer(Interop.Crypt32.CertEncodingType dwCertEncodingType, CryptDecodeObjectStructType lpszStructType, byte[] pbEncoded, int cbEncoded, Interop.Crypt32.CryptDecodeObjectFlags dwFlags, void* pvStructInfo, ref int pcbStructInfo) 88return Interop.Crypt32.CryptDecodeObjectPointer(dwCertEncodingType, (IntPtr)lpszStructType, pbEncoded, cbEncoded, dwFlags, pvStructInfo, ref pcbStructInfo); 91public static unsafe bool CryptDecodeObjectPointer(Interop.Crypt32.CertEncodingType dwCertEncodingType, CryptDecodeObjectStructType lpszStructType, ReadOnlySpan<byte> encoded, Interop.Crypt32.CryptDecodeObjectFlags dwFlags, void* pvStructInfo, ref int pcbStructInfo) 95return Interop.Crypt32.CryptDecodeObjectPointer(dwCertEncodingType, (IntPtr)lpszStructType, pEncoded, encoded.Length, dwFlags, pvStructInfo, ref pcbStructInfo); 99public static unsafe bool CryptEncodeObject(Interop.Crypt32.CertEncodingType dwCertEncodingType, CryptDecodeObjectStructType lpszStructType, void* pvStructInfo, byte[]? pbEncoded, ref int pcbEncoded) 101return Interop.Crypt32.CryptEncodeObject(dwCertEncodingType, (IntPtr)lpszStructType, pvStructInfo, pbEncoded, ref pcbEncoded); 107if (!Interop.crypt32.CryptEncodeObject(Interop.Crypt32.CertEncodingType.All, lpszStructType, decoded, null, ref cb)) 111if (!Interop.crypt32.CryptEncodeObject(Interop.Crypt32.CertEncodingType.All, lpszStructType, decoded, encoded, ref cb)) 120if (!Interop.Crypt32.CryptEncodeObject(Interop.Crypt32.CertEncodingType.All, lpszStructType, decoded, null, ref cb)) 124if (!Interop.Crypt32.CryptEncodeObject(Interop.Crypt32.CertEncodingType.All, lpszStructType, decoded, encoded, ref cb)) 130internal static SafeChainEngineHandle CertCreateCertificateChainEngine(ref Interop.Crypt32.CERT_CHAIN_ENGINE_CONFIG config) 132if (!Interop.Crypt32.CertCreateCertificateChainEngine(ref config, out SafeChainEngineHandle chainEngineHandle)) 149public static unsafe bool CertFindCertificateInStore(SafeCertStoreHandle hCertStore, Interop.Crypt32.CertFindType dwFindType, void* pvFindPara, [NotNull] ref SafeCertContextHandle? pCertContext) 151Interop.Crypt32.CERT_CONTEXT* pPrevCertContext = null; 158pCertContext = Interop.Crypt32.CertFindCertificateInStore(hCertStore, Interop.Crypt32.CertEncodingType.All, Interop.Crypt32.CertFindFlags.None, dwFindType, pvFindPara, pPrevCertContext); 162public static unsafe bool CertGetIntendedKeyUsage(Interop.Crypt32.CertEncodingType dwCertEncodingType, Interop.Crypt32.CERT_INFO* pCertInfo, out X509KeyUsageFlags pbKeyUsage, int cbKeyUsage) 164bool result = Interop.Crypt32.CertGetIntendedKeyUsage(dwCertEncodingType, pCertInfo, out Interop.Crypt32.X509KeyUsageFlags x509KeyUsageFlags, cbKeyUsage); 169public static bool CertVerifyCertificateChainPolicy(ChainPolicy pszPolicyOID, SafeX509ChainHandle pChainContext, ref Interop.Crypt32.CERT_CHAIN_POLICY_PARA pPolicyPara, ref Interop.Crypt32.CERT_CHAIN_POLICY_STATUS pPolicyStatus) 171return Interop.Crypt32.CertVerifyCertificateChainPolicy((IntPtr)pszPolicyOID, pChainContext, ref pPolicyPara, ref pPolicyStatus); 174public static bool CryptAcquireCertificatePrivateKey(SafeCertContextHandle pCert, Interop.Crypt32.CryptAcquireCertificatePrivateKeyFlags dwFlags, IntPtr pvParameters, out SafeNCryptKeyHandle phCryptProvOrNCryptKey, out int pdwKeySpec, out bool pfCallerFreeProvOrNCryptKey) 176bool result = Interop.Crypt32.CryptAcquireCertificatePrivateKey(pCert, dwFlags, pvParameters, out phCryptProvOrNCryptKey, out Interop.Crypt32.CryptKeySpec pdwKeySpecEnum, out pfCallerFreeProvOrNCryptKey);
System\Security\Cryptography\X509Certificates\WindowsStructs.cs (9)
18public Interop.Crypt32.DATA_BLOB Issuer; 19public Interop.Crypt32.DATA_BLOB SerialNumber; 58public Interop.Crypt32.DATA_BLOB p; 59public Interop.Crypt32.DATA_BLOB q; 60public Interop.Crypt32.DATA_BLOB g; 71public Interop.Crypt32.CRYPT_BIT_BLOB SubjectType; 75public Interop.Crypt32.DATA_BLOB* rgSubtreesConstraint; // PCERT_NAME_BLOB 108public Interop.Crypt32.DATA_BLOB Value; 184public Interop.Crypt32.CERT_CONTEXT* pCertContext;
System\Security\Cryptography\X509Certificates\X509CertificateLoader.Windows.cs (25)
19Interop.Crypt32.DATA_BLOB blob = new Interop.Crypt32.DATA_BLOB( 24Interop.Crypt32.CertQueryObjectType.CERT_QUERY_OBJECT_BLOB, 37Interop.Crypt32.CertQueryObjectType.CERT_QUERY_OBJECT_FILE, 96while (Interop.crypt32.CertEnumCertificatesInStore(storeHandle, ref nextCert)) 163while (Interop.crypt32.CertEnumCertificatesInStore(storeHandle, ref nextCert)) 177Interop.Crypt32.CertQueryObjectType objectType, 183const Interop.Crypt32.ContentType ContentType = 184Interop.Crypt32.ContentType.CERT_QUERY_CONTENT_CERT; 185const Interop.Crypt32.ExpectedContentTypeFlags ExpectedContentType = 186Interop.Crypt32.ExpectedContentTypeFlags.CERT_QUERY_CONTENT_FLAG_CERT; 188bool loaded = Interop.Crypt32.CryptQueryObject( 192Interop.Crypt32.ExpectedFormatTypeFlags.CERT_QUERY_FORMAT_FLAG_ALL, 195out Interop.Crypt32.ContentType actualType, 240Interop.Crypt32.PfxCertStoreFlags flags = MapKeyStorageFlags(keyStorageFlags); 257Interop.Crypt32.DATA_BLOB blob = new((IntPtr)dataPtr, (uint)data.Length); 259storeHandle = Interop.Crypt32.PFXImportCertStore( 280private static Interop.Crypt32.PfxCertStoreFlags MapKeyStorageFlags(X509KeyStorageFlags keyStorageFlags) 284Interop.Crypt32.PfxCertStoreFlags pfxCertStoreFlags = 0; 287pfxCertStoreFlags |= Interop.Crypt32.PfxCertStoreFlags.CRYPT_USER_KEYSET; 289pfxCertStoreFlags |= Interop.Crypt32.PfxCertStoreFlags.CRYPT_MACHINE_KEYSET; 292pfxCertStoreFlags |= Interop.Crypt32.PfxCertStoreFlags.CRYPT_EXPORTABLE; 294pfxCertStoreFlags |= Interop.Crypt32.PfxCertStoreFlags.CRYPT_USER_PROTECTED; 302pfxCertStoreFlags |= Interop.Crypt32.PfxCertStoreFlags.PKCS12_NO_PERSIST_KEY | Interop.Crypt32.PfxCertStoreFlags.PKCS12_ALWAYS_CNG_KSP;
System\Security\Cryptography\X509Certificates\X509Pal.Windows.GetCertContentType.cs (20)
17Interop.Crypt32.ContentType contentType; 23Interop.Crypt32.DATA_BLOB certBlob = new Interop.Crypt32.DATA_BLOB(new IntPtr(pRawData), (uint)rawData.Length); 24if (!Interop.Crypt32.CryptQueryObject( 25Interop.Crypt32.CertQueryObjectType.CERT_QUERY_OBJECT_BLOB, 27Interop.Crypt32.ExpectedContentTypeFlags.CERT_QUERY_CONTENT_FLAG_ALL, 28Interop.Crypt32.ExpectedFormatTypeFlags.CERT_QUERY_FORMAT_FLAG_ALL, 47Interop.Crypt32.ContentType contentType; 53if (!Interop.Crypt32.CryptQueryObject( 54Interop.Crypt32.CertQueryObjectType.CERT_QUERY_OBJECT_FILE, 56Interop.Crypt32.ExpectedContentTypeFlags.CERT_QUERY_CONTENT_FLAG_ALL, 57Interop.Crypt32.ExpectedFormatTypeFlags.CERT_QUERY_FORMAT_FLAG_ALL, 78private static X509ContentType MapContentType(Interop.Crypt32.ContentType contentType) 82case Interop.Crypt32.ContentType.CERT_QUERY_CONTENT_CERT: 84case Interop.Crypt32.ContentType.CERT_QUERY_CONTENT_SERIALIZED_STORE: 86case Interop.Crypt32.ContentType.CERT_QUERY_CONTENT_SERIALIZED_CERT: 88case Interop.Crypt32.ContentType.CERT_QUERY_CONTENT_PKCS7_SIGNED: 89case Interop.Crypt32.ContentType.CERT_QUERY_CONTENT_PKCS7_UNSIGNED: 91case Interop.Crypt32.ContentType.CERT_QUERY_CONTENT_PKCS7_SIGNED_EMBED: 93case Interop.Crypt32.ContentType.CERT_QUERY_CONTENT_PFX:
System\Security\Cryptography\X509Certificates\X509Pal.Windows.PublicKey.cs (17)
9using static Interop.Crypt32; 10using NTSTATUS = Interop.BCrypt.NTSTATUS; 51int algId = Interop.Crypt32.FindOidInfo(CryptOidInfoKeyType.CRYPT_OID_INFO_OID_KEY, oid.Value!, OidGroup.PublicKeyAlgorithm, fallBackToAllGroups: true).AlgId; 136bool success = Interop.Crypt32.CryptImportPublicKeyInfoEx2( 137Interop.Crypt32.CertEncodingType.X509_ASN_ENCODING, 165return Interop.BCrypt.BCryptExportKey(bCryptKeyHandle, blobFormatString); 179Debug.Assert(ecBlob.Length >= sizeof(Interop.BCrypt.BCRYPT_ECCKEY_BLOB)); 183Interop.BCrypt.BCRYPT_ECCKEY_BLOB* pBcryptBlob = (Interop.BCrypt.BCRYPT_ECCKEY_BLOB*)pEcBlob; 185int offset = sizeof(Interop.BCrypt.BCRYPT_ECCKEY_BLOB); 189X = Interop.BCrypt.Consume(ecBlob, ref offset, pBcryptBlob->cbKey), 190Y = Interop.BCrypt.Consume(ecBlob, ref offset, pBcryptBlob->cbKey) 195ecParams.D = Interop.BCrypt.Consume(ecBlob, ref offset, pBcryptBlob->cbKey); 204if (!Interop.crypt32.CryptDecodeObject(CertEncodingType.All, lpszStructType, encodedKeyValue, encodedKeyValue.Length, CryptDecodeObjectFlags.None, null, ref cbDecoded)) 208if (!Interop.crypt32.CryptDecodeObject(CertEncodingType.All, lpszStructType, encodedKeyValue, encodedKeyValue.Length, CryptDecodeObjectFlags.None, keyBlob, ref cbDecoded)) 353NTSTATUS errorCode = Interop.BCrypt.BCryptGetProperty(cryptHandle, propertyName, null, 0, out numBytesNeeded, 0); 360errorCode = Interop.BCrypt.BCryptGetProperty(cryptHandle, propertyName, pPropertyValue, propertyValue.Length, out numBytesNeeded, 0);
System\Security\Cryptography\X509Certificates\X509Pal.Windows.X500DistinguishedName.cs (29)
18int dwStrType = (int)(Interop.Crypt32.CertNameStrTypeAndFlags.CERT_X500_NAME_STR | MapNameToStrFlag(flag)); 23Interop.Crypt32.DATA_BLOB nameBlob; 27int cchDecoded = Interop.Crypt32.CertNameToStr((int)Interop.Crypt32.CertEncodingType.All, &nameBlob, dwStrType, null, 0); 34if (Interop.Crypt32.CertNameToStr((int)Interop.Crypt32.CertEncodingType.All, &nameBlob, dwStrType, ptr, cchDecoded) == 0) 47Interop.Crypt32.CertNameStrTypeAndFlags dwStrType = Interop.Crypt32.CertNameStrTypeAndFlags.CERT_X500_NAME_STR | MapNameToStrFlag(flag); 50if (!Interop.Crypt32.CertStrToName(Interop.Crypt32.CertEncodingType.All, distinguishedName, dwStrType, IntPtr.Zero, null, ref cbEncoded, IntPtr.Zero)) 54if (!Interop.Crypt32.CertStrToName(Interop.Crypt32.CertEncodingType.All, distinguishedName, dwStrType, IntPtr.Zero, encodedName, ref cbEncoded, IntPtr.Zero)) 65int stringType = multiLine ? Interop.Crypt32.CRYPT_FORMAT_STR_MULTI_LINE : Interop.Crypt32.CRYPT_FORMAT_STR_NONE; 68if (!Interop.Crypt32.CryptFormatObject( 69(int)Interop.Crypt32.CertEncodingType.X509_ASN_ENCODING, 86if (!Interop.Crypt32.CryptFormatObject( 87(int)Interop.Crypt32.CertEncodingType.X509_ASN_ENCODING, 104private static Interop.Crypt32.CertNameStrTypeAndFlags MapNameToStrFlag(X500DistinguishedNameFlags flag) 111Interop.Crypt32.CertNameStrTypeAndFlags dwStrType = 0; 115dwStrType |= Interop.Crypt32.CertNameStrTypeAndFlags.CERT_NAME_STR_REVERSE_FLAG; 118dwStrType |= Interop.Crypt32.CertNameStrTypeAndFlags.CERT_NAME_STR_SEMICOLON_FLAG; 120dwStrType |= Interop.Crypt32.CertNameStrTypeAndFlags.CERT_NAME_STR_COMMA_FLAG; 122dwStrType |= Interop.Crypt32.CertNameStrTypeAndFlags.CERT_NAME_STR_CRLF_FLAG; 125dwStrType |= Interop.Crypt32.CertNameStrTypeAndFlags.CERT_NAME_STR_NO_PLUS_FLAG; 127dwStrType |= Interop.Crypt32.CertNameStrTypeAndFlags.CERT_NAME_STR_NO_QUOTING_FLAG; 130dwStrType |= Interop.Crypt32.CertNameStrTypeAndFlags.CERT_NAME_STR_FORCE_UTF8_DIR_STR_FLAG; 133dwStrType |= Interop.Crypt32.CertNameStrTypeAndFlags.CERT_NAME_STR_ENABLE_UTF8_UNICODE_FLAG; 135dwStrType |= Interop.Crypt32.CertNameStrTypeAndFlags.CERT_NAME_STR_ENABLE_T61_UNICODE_FLAG;