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

◆ LinkFromCertificateCollection()

static IExportPal Internal.Cryptography.Pal.StorePal.LinkFromCertificateCollection ( X509Certificate2Collection certificates)
inlinestatic

Definition at line 269 of file StorePal.cs.

270 {
271 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);
272 if (safeCertStoreHandle.IsInvalid)
273 {
274 throw Marshal.GetHRForLastWin32Error().ToCryptographicException();
275 }
276 for (int i = 0; i < certificates.Count; i++)
277 {
278 SafeCertContextHandle certContext = ((CertificatePal)certificates[i].Pal).CertContext;
279 if (!global::Interop.crypt32.CertAddCertificateLinkToStore(safeCertStoreHandle, certContext, CertStoreAddDisposition.CERT_STORE_ADD_ALWAYS, IntPtr.Zero))
280 {
281 throw Marshal.GetLastWin32Error().ToCryptographicException();
282 }
283 }
284 return new StorePal(safeCertStoreHandle);
285 }
StorePal(SafeCertStoreHandle certStore)
Definition StorePal.cs:89
static readonly IntPtr Zero
Definition IntPtr.cs:18

References Internal.Cryptography.Pal.StorePal.StorePal(), Internal.Cryptography.Pal.Native.SafeCertContextHandle.CertContext, System.Collections.CollectionBase.Count, System.Runtime.InteropServices.Marshal.GetHRForLastWin32Error(), System.Runtime.InteropServices.Marshal.GetLastWin32Error(), Internal.Cryptography.Pal.Native.SafePointerHandle< T >.IsInvalid, and System.IntPtr.Zero.

Referenced by Internal.Cryptography.Pal.FindPal.FindPal(), Internal.Cryptography.Pal.ChainPal.ConvertStoreToSafeHandle(), and System.Security.Cryptography.X509Certificates.X509Certificate2Collection.Export().