Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ FindCore< TState >() [1/2]

unsafe void Internal.Cryptography.Pal.FindPal.FindCore< TState > ( CertFindType dwFindType,
void * pvFindPara,
TState state = default(TState),
Func< TState, SafeCertContextHandle, bool > filter = null )
inlineprivate

Definition at line 531 of file FindPal.cs.

532 {
533 SafeCertStoreHandle safeCertStoreHandle = global::Interop.crypt32.CertOpenStore(CertStoreProvider.CERT_STORE_PROV_MEMORY, CertEncodingType.All, IntPtr.Zero, CertStoreFlags.CERT_STORE_ENUM_ARCHIVED_FLAG | CertStoreFlags.CERT_STORE_CREATE_NEW_FLAG, null);
534 if (safeCertStoreHandle.IsInvalid)
535 {
536 throw Marshal.GetHRForLastWin32Error().ToCryptographicException();
537 }
538 SafeCertContextHandle pCertContext = null;
539 while (global::Interop.crypt32.CertFindCertificateInStore(_storePal.SafeCertStoreHandle, dwFindType, pvFindPara, ref pCertContext))
540 {
541 if ((filter == null || filter(state, pCertContext)) && (!_validOnly || VerifyCertificateIgnoringErrors(pCertContext)) && !global::Interop.crypt32.CertAddCertificateLinkToStore(safeCertStoreHandle, pCertContext, CertStoreAddDisposition.CERT_STORE_ADD_ALWAYS, IntPtr.Zero))
542 {
543 throw Marshal.GetLastWin32Error().ToCryptographicException();
544 }
545 }
546 using StorePal storePal = new StorePal(safeCertStoreHandle);
548 }
static bool VerifyCertificateIgnoringErrors(SafeCertContextHandle pCertContext)
Definition FindPal.cs:550
readonly X509Certificate2Collection _copyTo
Definition FindPal.cs:55
readonly StorePal _storePal
Definition FindPal.cs:53
SafeCertStoreHandle SafeCertStoreHandle
Definition StorePal.cs:15
void CopyTo(KeyValuePair< TKey, TValue >[] array, int index)
static readonly IntPtr Zero
Definition IntPtr.cs:18

References Internal.Cryptography.Pal.FindPal._copyTo, Internal.Cryptography.Pal.FindPal._storePal, Internal.Cryptography.Pal.FindPal._validOnly, System.Collections.Generic.Dictionary< TKey, TValue >.CopyTo(), System.Runtime.InteropServices.Marshal.GetHRForLastWin32Error(), System.Runtime.InteropServices.Marshal.GetLastWin32Error(), Internal.Cryptography.Pal.StorePal.SafeCertStoreHandle, System.state, Internal.Cryptography.Pal.FindPal.VerifyCertificateIgnoringErrors(), and System.IntPtr.Zero.