14 [DllImport(
"advapi32.dll",
CharSet =
CharSet.Unicode, EntryPoint =
"CryptAcquireContextW", SetLastError =
true)]
21 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
22 public unsafe
static extern bool CryptQueryObject(
CertQueryObjectType dwObjectType,
void* pvObject,
ExpectedContentTypeFlags dwExpectedContentTypeFlags,
ExpectedFormatTypeFlags dwExpectedFormatTypeFlags,
int dwFlags, out
CertEncodingType pdwMsgAndCertEncodingType, out
ContentType pdwContentType, out
FormatType pdwFormatType, out
SafeCertStoreHandle phCertStore, out
SafeCryptMsgHandle phMsg, out
SafeCertContextHandle ppvContext);
24 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
25 public unsafe
static extern bool CryptQueryObject(
CertQueryObjectType dwObjectType,
void* pvObject,
ExpectedContentTypeFlags dwExpectedContentTypeFlags,
ExpectedFormatTypeFlags dwExpectedFormatTypeFlags,
int dwFlags,
IntPtr pdwMsgAndCertEncodingType, out
ContentType pdwContentType,
IntPtr pdwFormatType,
IntPtr phCertStore,
IntPtr phMsg,
IntPtr ppvContext);
27 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
28 public unsafe
static extern bool CryptQueryObject(
CertQueryObjectType dwObjectType,
void* pvObject,
ExpectedContentTypeFlags dwExpectedContentTypeFlags,
ExpectedFormatTypeFlags dwExpectedFormatTypeFlags,
int dwFlags,
IntPtr pdwMsgAndCertEncodingType, out
ContentType pdwContentType,
IntPtr pdwFormatType, out
SafeCertStoreHandle phCertStore,
IntPtr phMsg,
IntPtr ppvContext);
30 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
33 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
36 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
39 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, EntryPoint =
"CertGetCertificateContextProperty", SetLastError =
true)]
42 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
45 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
48 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
53 int num =
CertGetNameString(certContext, certNameType, certNameFlags, in strType,
null, 0);
60 fixed (
char* pszNameString = &
MemoryMarshal.GetReference(span2))
62 if (
CertGetNameString(certContext, certNameType, certNameFlags, in strType, pszNameString, num) == 0)
70 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, EntryPoint =
"CertGetNameStringW", SetLastError =
true)]
73 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
76 [DllImport(
"crypt32.dll", SetLastError =
true)]
79 [DllImport(
"crypt32.dll", SetLastError =
true)]
82 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, EntryPoint =
"CertDuplicateCertificateContext", SetLastError =
true)]
87 return CertOpenStore((
IntPtr)(
int)lpszStoreProvider, dwMsgAndCertEncodingType, hCryptProv, dwFlags, pvPara);
90 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
93 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
96 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
102 if (pCertContext ==
null)
105 pPrevCertContext =
null;
109 pPrevCertContext = pCertContext.Disconnect();
112 if (!pCertContext.IsInvalid)
116 pCertContext.Dispose();
120 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
123 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
126 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
129 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
132 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
135 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
138 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, EntryPoint =
"CertStrToNameW", SetLastError =
true)]
143 return CryptDecodeObject(dwCertEncodingType, (
IntPtr)(
int)lpszStructType, pbEncoded, cbEncoded, dwFlags, pvStructInfo, ref pcbStructInfo);
146 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
154 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, EntryPoint =
"CryptDecodeObject", SetLastError =
true)]
157 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, EntryPoint =
"CryptDecodeObject", SetLastError =
true)]
162 return CryptEncodeObject(dwCertEncodingType, (
IntPtr)(
int)lpszStructType, pvStructInfo, pbEncoded, ref pcbEncoded);
165 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
168 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
178 byte[]
array =
new byte[pcbEncoded];
186 public unsafe
static byte[]
EncodeObject(
string lpszStructType,
void* decoded)
193 byte[]
array =
new byte[pcbEncoded];
206 throw lastWin32Error.ToCryptographicException();
208 return hChainEngineHandle;
211 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
214 [DllImport(
"crypt32.dll")]
217 [DllImport(
"crypt32.dll", SetLastError =
true)]
220 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
223 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
228 CERT_CONTEXT* pPrevCertContext = ((pCertContext ==
null) ?
null : pCertContext.Disconnect());
230 return !pCertContext.IsInvalid;
233 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
236 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
239 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
242 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
245 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
248 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
251 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
254 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
262 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
265 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
268 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
274 internal struct CRYPT_OID_INFO
303 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
306 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, EntryPoint =
"CertNameToStrW", SetLastError =
true)]
307 internal unsafe
static extern int CertNameToStr(
int dwCertEncodingType,
void* pName,
int dwStrType,
char* psz,
int csz);
309 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
312 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
315 [DllImport(
"crypt32.dll", BestFitMapping =
false, SetLastError =
true)]
316 internal unsafe
static extern bool CryptFormatObject([In]
int dwCertEncodingType, [In]
int dwFormatType, [In]
int dwFormatStrType, [In]
IntPtr pFormatStruct, [In]
byte* lpszStructType, [In]
byte[] pbEncoded, [In]
int cbEncoded, [Out]
void* pbFormat, [In][Out] ref
int pcbFormat);
323 intPtr = keyType
switch
343 if (fallBackToAllGroups && group != 0)
368 return group ==
OidGroup.KeyDerivationFunction;
379 [DllImport(
"kernel32.dll", BestFitMapping =
true,
CharSet =
CharSet.Unicode, EntryPoint =
"FormatMessageW", ExactSpelling =
true,
SetLastError =
true)]
380 private unsafe
static extern int FormatMessage(
int dwFlags,
IntPtr lpSource, uint dwMessageId,
int dwLanguageId,
void* lpBuffer,
int nSize,
IntPtr arguments);
395 fixed (
char* lpBuffer = span)
419 return $
"Unknown error (0x{errorCode:x})";
425 while (num > 0 &&
buffer[num - 1] <=
' ')
429 return buffer.Slice(0, num).ToString();
433 internal static class BCrypt
463 internal struct BCRYPT_ECCKEY_BLOB
465 internal KeyBlobMagicNumber
Magic;
static unsafe NTSTATUS BCryptGetProperty(Microsoft.Win32.SafeHandles.SafeBCryptHandle hObject, string pszProperty, void *pbOutput, int cbOutput, out int pcbResult, int dwFlags)
@ STATUS_AUTH_TAG_MISMATCH
@ STATUS_INVALID_PARAMETER
static NTSTATUS BCryptExportKey(Microsoft.Win32.SafeHandles.SafeBCryptKeyHandle hKey, IntPtr hExportKey, string pszBlobType, [Out] byte[] pbOutput, int cbOutput, out int pcbResult, int dwFlags)
static NTSTATUS BCryptDestroyKey(IntPtr hKey)
static byte[] Consume(byte[] blob, ref int offset, int count)
@ BCRYPT_ECDH_PUBLIC_P521_MAGIC
@ BCRYPT_DSA_PRIVATE_MAGIC
@ BCRYPT_ECDH_PRIVATE_P256_MAGIC
@ BCRYPT_RSAFULLPRIVATE_MAGIC
@ BCRYPT_ECDSA_PUBLIC_P384_MAGIC
@ BCRYPT_ECDH_PRIVATE_GENERIC_MAGIC
@ BCRYPT_ECDH_PUBLIC_P256_MAGIC
@ BCRYPT_ECDH_PUBLIC_GENERIC_MAGIC
@ BCRYPT_ECDH_PRIVATE_P384_MAGIC
@ BCRYPT_ECDH_PRIVATE_P521_MAGIC
@ BCRYPT_ECDSA_PRIVATE_GENERIC_MAGIC
@ BCRYPT_ECDSA_PUBLIC_P256_MAGIC
@ BCRYPT_ECDSA_PUBLIC_GENERIC_MAGIC
@ BCRYPT_ECDH_PUBLIC_P384_MAGIC
@ BCRYPT_DSA_PUBLIC_MAGIC_V2
@ BCRYPT_DSA_PRIVATE_MAGIC_V2
@ BCRYPT_KEY_DATA_BLOB_MAGIC
@ BCRYPT_DSA_PUBLIC_MAGIC
@ BCRYPT_ECDSA_PUBLIC_P521_MAGIC
@ BCRYPT_ECDSA_PRIVATE_P256_MAGIC
@ BCRYPT_ECDSA_PRIVATE_P521_MAGIC
@ BCRYPT_RSAPRIVATE_MAGIC
@ BCRYPT_ECDSA_PRIVATE_P384_MAGIC
static CRYPT_OID_INFO FindOidInfo(CryptOidInfoKeyType keyType, string key, OidGroup group, bool fallBackToAllGroups)
@ CRYPT_OID_INFO_NAME_KEY
@ CRYPT_OID_INFO_CNG_SIGN_KEY
@ CRYPT_OID_INFO_SIGN_KEY
@ CRYPT_OID_INFO_CNG_ALGID_KEY
@ CRYPT_OID_INFO_ALGID_KEY
static unsafe int CertNameToStr(int dwCertEncodingType, void *pName, int dwStrType, char *psz, int csz)
static bool CryptMsgClose(IntPtr hCryptMsg)
static bool CertFreeCertificateContext(IntPtr pCertContext)
static bool CertCloseStore(IntPtr hCertStore, uint dwFlags)
static unsafe bool CryptFormatObject([In] int dwCertEncodingType, [In] int dwFormatType, [In] int dwFormatStrType, [In] IntPtr pFormatStruct, [In] byte *lpszStructType, [In] byte[] pbEncoded, [In] int cbEncoded, [Out] void *pbFormat, [In][Out] ref int pcbFormat)
static IntPtr CryptFindOIDInfo(CryptOidInfoKeyType dwKeyType, IntPtr pvKey, OidGroup group)
static bool OidGroupWillNotUseActiveDirectory(OidGroup group)
static unsafe string GetMessage(int errorCode, IntPtr moduleHandle)
static void SetLastError(int errorCode)
static string GetMessage(int errorCode)
static unsafe int FormatMessage(int dwFlags, IntPtr lpSource, uint dwMessageId, int dwLanguageId, void *lpBuffer, int nSize, IntPtr arguments)
static string GetAndTrimString(Span< char > buffer)
static unsafe byte[] EncodeObject(CryptDecodeObjectStructType lpszStructType, void *decoded)
static bool CertGetCertificateContextProperty(SafeCertContextHandle pCertContext, CertContextPropId dwPropId, out CRYPTOAPI_BLOB pvData, [In][Out] ref int pcbData)
static unsafe bool CertGetValidUsages(int cCerts, [In] ref SafeCertContextHandle rghCerts, out int cNumOIDs, [Out] void *rghOIDs, [In][Out] ref int pcbOIDs)
static unsafe bool CryptQueryObject(CertQueryObjectType dwObjectType, void *pvObject, ExpectedContentTypeFlags dwExpectedContentTypeFlags, ExpectedFormatTypeFlags dwExpectedFormatTypeFlags, int dwFlags, IntPtr pdwMsgAndCertEncodingType, out ContentType pdwContentType, IntPtr pdwFormatType, out SafeCertStoreHandle phCertStore, IntPtr phMsg, IntPtr ppvContext)
static unsafe SafeCertContextHandle CertFindCertificateInStore(SafeCertStoreHandle hCertStore, CertEncodingType dwCertEncodingType, CertFindFlags dwFindFlags, CertFindType dwFindType, void *pvFindPara, CERT_CONTEXT *pPrevCertContext)
static bool CryptMsgGetParam(SafeCryptMsgHandle hCryptMsg, CryptMessageParameterType dwParamType, int dwIndex, out int pvData, [In][Out] ref int pcbData)
static unsafe bool CryptEncodeObject(CertEncodingType dwCertEncodingType, [MarshalAs(UnmanagedType.LPStr)] string lpszStructType, void *pvStructInfo, [Out] byte[] pbEncoded, [In][Out] ref int pcbEncoded)
static unsafe string CertGetNameString(SafeCertContextHandle certContext, CertNameType certNameType, CertNameFlags certNameFlags, CertNameStringType strType)
static bool CertVerifyCertificateChainPolicy(IntPtr pszPolicyOID, SafeX509ChainHandle pChainContext, [In] ref CERT_CHAIN_POLICY_PARA pPolicyPara, [In][Out] ref CERT_CHAIN_POLICY_STATUS pPolicyStatus)
static bool CertSaveStore(SafeCertStoreHandle hCertStore, CertEncodingType dwMsgAndCertEncodingType, CertStoreSaveAs dwSaveAs, CertStoreSaveTo dwSaveTo, ref CRYPTOAPI_BLOB pvSaveToPara, int dwFlags)
static unsafe bool CryptEncodeObject(CertEncodingType dwCertEncodingType, IntPtr lpszStructType, void *pvStructInfo, [Out] byte[] pbEncoded, [In][Out] ref int pcbEncoded)
static unsafe bool CryptEncodeObject(CertEncodingType dwCertEncodingType, CryptDecodeObjectStructType lpszStructType, void *pvStructInfo, byte[] pbEncoded, ref int pcbEncoded)
static SafeCertStoreHandle CertOpenStore(CertStoreProvider lpszStoreProvider, CertEncodingType dwMsgAndCertEncodingType, IntPtr hCryptProv, CertStoreFlags dwFlags, string pvPara)
static SafeCertStoreHandle CertOpenStore(IntPtr lpszStoreProvider, CertEncodingType dwMsgAndCertEncodingType, IntPtr hCryptProv, CertStoreFlags dwFlags, [MarshalAs(UnmanagedType.LPWStr)] string pvPara)
static bool CertGetCertificateContextProperty(SafeCertContextHandle pCertContext, CertContextPropId dwPropId, [Out] byte[] pvData, [In][Out] ref int pcbData)
static unsafe int CertGetNameString(SafeCertContextHandle pCertContext, CertNameType dwType, CertNameFlags dwFlags, in CertNameStringType pvTypePara, char *pszNameString, int cchNameString)
static unsafe int CertVerifyTimeValidity([In] ref FILETIME pTimeToVerify, [In] CERT_INFO *pCertInfo)
static bool CertAddCertificateContextToStore(SafeCertStoreHandle hCertStore, SafeCertContextHandle pCertContext, CertStoreAddDisposition dwAddDisposition, IntPtr ppStoreContext)
static SafeX509ChainHandle CertDuplicateCertificateChain(IntPtr pChainContext)
static SafeCertStoreHandle PFXImportCertStore([In] ref CRYPTOAPI_BLOB pPFX, SafePasswordHandle password, PfxCertStoreFlags dwFlags)
static unsafe bool CryptImportPublicKeyInfoEx2(CertEncodingType dwCertEncodingType, CERT_PUBLIC_KEY_INFO *pInfo, CryptImportPublicKeyInfoFlags dwFlags, void *pvAuxInfo, out Microsoft.Win32.SafeHandles.SafeBCryptKeyHandle phKey)
static bool CryptHashPublicKeyInfo(IntPtr hCryptProv, int algId, int dwFlags, CertEncodingType dwCertEncodingType, [In] ref CERT_PUBLIC_KEY_INFO pInfo, [Out] byte[] pbComputedHash, [In][Out] ref int pcbComputedHash)
static bool CertSetCertificateContextProperty(SafeCertContextHandle pCertContext, CertContextPropId dwPropId, CertSetPropertyFlags dwFlags, [In] SafeNCryptKeyHandle keyHandle)
static bool CertAddCertificateLinkToStore(SafeCertStoreHandle hCertStore, SafeCertContextHandle pCertContext, CertStoreAddDisposition dwAddDisposition, IntPtr ppStoreContext)
static unsafe bool CryptDecodeObjectPointer(CertEncodingType dwCertEncodingType, CryptDecodeObjectStructType lpszStructType, byte[] pbEncoded, int cbEncoded, CryptDecodeObjectFlags dwFlags, void *pvStructInfo, ref int pcbStructInfo)
static SafeCertContextHandleWithKeyContainerDeletion CertDuplicateCertificateContextWithKeyContainerDeletion(IntPtr pCertContext)
static void CertFreeCertificateChainEngine(IntPtr hChainEngine)
static unsafe bool CryptQueryObject(CertQueryObjectType dwObjectType, void *pvObject, ExpectedContentTypeFlags dwExpectedContentTypeFlags, ExpectedFormatTypeFlags dwExpectedFormatTypeFlags, int dwFlags, IntPtr pdwMsgAndCertEncodingType, out ContentType pdwContentType, IntPtr pdwFormatType, IntPtr phCertStore, IntPtr phMsg, IntPtr ppvContext)
static unsafe bool CertGetIntendedKeyUsage(CertEncodingType dwCertEncodingType, CERT_INFO *pCertInfo, out X509KeyUsageFlags pbKeyUsage, int cbKeyUsage)
static bool PFXExportCertStore(SafeCertStoreHandle hStore, [In][Out] ref CRYPTOAPI_BLOB pPFX, SafePasswordHandle szPassword, PFXExportFlags dwFlags)
static bool CertControlStore(SafeCertStoreHandle hCertStore, CertControlStoreFlags dwFlags, CertControlStoreType dwControlType, IntPtr pvCtrlPara)
static bool CertSerializeCertificateStoreElement(SafeCertContextHandle pCertContext, int dwFlags, [Out] byte[] pbElement, [In][Out] ref int pcbElement)
static SafeCertContextHandle CertDuplicateCertificateContext(IntPtr pCertContext)
static SafeCertStoreHandle CertDuplicateStore(IntPtr hCertStore)
static unsafe bool CryptDecodeObjectPointer(CertEncodingType dwCertEncodingType, [MarshalAs(UnmanagedType.LPStr)] string lpszStructType, [In] byte[] pbEncoded, int cbEncoded, CryptDecodeObjectFlags dwFlags, [Out] void *pvStructInfo, [In][Out] ref int pcbStructInfo)
static void CertFreeCertificateChain(IntPtr pChainContext)
static unsafe bool CertSetCertificateContextProperty(SafeCertContextHandle pCertContext, CertContextPropId dwPropId, CertSetPropertyFlags dwFlags, [In] CRYPT_KEY_PROV_INFO *pvData)
static unsafe bool CertDeleteCertificateFromStore(CERT_CONTEXT *pCertContext)
static unsafe bool CertGetCertificateContextPropertyString(SafeCertContextHandle pCertContext, CertContextPropId dwPropId, byte *pvData, ref int pcbData)
static bool CertStrToName(CertEncodingType dwCertEncodingType, string pszX500, CertNameStrTypeAndFlags dwStrType, IntPtr pvReserved, [Out] byte[] pbEncoded, [In][Out] ref int pcbEncoded, IntPtr ppszError)
static bool CryptDecodeObject(CertEncodingType dwCertEncodingType, CryptDecodeObjectStructType lpszStructType, byte[] pbEncoded, int cbEncoded, CryptDecodeObjectFlags dwFlags, byte[] pvStructInfo, ref int pcbStructInfo)
static unsafe bool CertSetCertificateContextProperty(SafeCertContextHandle pCertContext, CertContextPropId dwPropId, CertSetPropertyFlags dwFlags, [In] CRYPTOAPI_BLOB *pvData)
static bool CryptAcquireCertificatePrivateKey(SafeCertContextHandle pCert, CryptAcquireFlags dwFlags, IntPtr pvParameters, out SafeNCryptKeyHandle phCryptProvOrNCryptKey, out int pdwKeySpec, out bool pfCallerFreeProvOrNCryptKey)
static unsafe bool CryptMsgGetParam(SafeCryptMsgHandle hCryptMsg, CryptMessageParameterType dwParamType, int dwIndex, byte *pvData, [In][Out] ref int pcbData)
static unsafe bool CertEnumCertificatesInStore(SafeCertStoreHandle hCertStore, [NotNull] ref SafeCertContextHandle pCertContext)
static unsafe CERT_EXTENSION * CertFindExtension([MarshalAs(UnmanagedType.LPStr)] string pszObjId, int cExtensions, CERT_EXTENSION *rgExtensions)
static unsafe CERT_CONTEXT * CertEnumCertificatesInStore(SafeCertStoreHandle hCertStore, CERT_CONTEXT *pPrevCertContext)
static bool CertVerifyCertificateChainPolicy(ChainPolicy pszPolicyOID, SafeX509ChainHandle pChainContext, ref CERT_CHAIN_POLICY_PARA pPolicyPara, ref CERT_CHAIN_POLICY_STATUS pPolicyStatus)
static bool CertCreateCertificateChainEngine(ref CERT_CHAIN_ENGINE_CONFIG pConfig, out SafeChainEngineHandle hChainEngineHandle)
static unsafe bool CryptQueryObject(CertQueryObjectType dwObjectType, void *pvObject, ExpectedContentTypeFlags dwExpectedContentTypeFlags, ExpectedFormatTypeFlags dwExpectedFormatTypeFlags, int dwFlags, out CertEncodingType pdwMsgAndCertEncodingType, out ContentType pdwContentType, out FormatType pdwFormatType, out SafeCertStoreHandle phCertStore, out SafeCryptMsgHandle phMsg, out SafeCertContextHandle ppvContext)
static unsafe byte[] EncodeObject(string lpszStructType, void *decoded)
static unsafe bool CertGetCertificateChain(IntPtr hChainEngine, SafeCertContextHandle pCertContext, FILETIME *pTime, SafeCertStoreHandle hStore, [In] ref CERT_CHAIN_PARA pChainPara, CertChainFlags dwFlags, IntPtr pvReserved, out SafeX509ChainHandle ppChainContext)
static bool CertGetCertificateContextProperty(SafeCertContextHandle pCertContext, CertContextPropId dwPropId, out IntPtr pvData, [In][Out] ref int pcbData)
static SafeChainEngineHandle CertCreateCertificateChainEngine(ref CERT_CHAIN_ENGINE_CONFIG config)
static unsafe bool CryptDecodeObjectPointer(CertEncodingType dwCertEncodingType, IntPtr lpszStructType, [In] byte[] pbEncoded, int cbEncoded, CryptDecodeObjectFlags dwFlags, [Out] void *pvStructInfo, [In][Out] ref int pcbStructInfo)
static bool CryptDecodeObject(CertEncodingType dwCertEncodingType, IntPtr lpszStructType, [In] byte[] pbEncoded, int cbEncoded, CryptDecodeObjectFlags dwFlags, [Out] byte[] pvStructInfo, [In][Out] ref int pcbStructInfo)
static unsafe bool CertFindCertificateInStore(SafeCertStoreHandle hCertStore, CertFindType dwFindType, void *pvFindPara, [NotNull] ref SafeCertContextHandle pCertContext)
static unsafe bool CryptAcquireContext(out IntPtr psafeProvHandle, char *pszContainer, char *pszProvider, int dwProvType, CryptAcquireContextFlags dwFlags)
static void BlockCopy(Array src, int srcOffset, Array dst, int dstOffset, int count)
static unsafe IntPtr StringToCoTaskMemUni(string? s)
static void FreeHGlobal(IntPtr hglobal)
static void FreeCoTaskMem(IntPtr ptr)
static unsafe? string PtrToStringAnsi(IntPtr ptr)
static int GetLastWin32Error()
static ? object PtrToStructure(IntPtr ptr, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors|DynamicallyAccessedMemberTypes.NonPublicConstructors)] Type structureType)
static unsafe IntPtr StringToCoTaskMemAnsi(string? s)
CryptImportPublicKeyInfoFlags
CryptDecodeObjectStructType
CryptMessageParameterType
static readonly IntPtr Zero
Span< T > Slice(int start)