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

◆ FromCertificate()

static IExportPal Internal.Cryptography.Pal.StorePal.FromCertificate ( ICertificatePalCore cert)
inlinestatic

Definition at line 254 of file StorePal.cs.

255 {
256 CertificatePal certificatePal = (CertificatePal)cert;
257 SafeCertStoreHandle safeCertStoreHandle = global::Interop.crypt32.CertOpenStore(CertStoreProvider.CERT_STORE_PROV_MEMORY, CertEncodingType.All, IntPtr.Zero, CertStoreFlags.CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG | CertStoreFlags.CERT_STORE_ENUM_ARCHIVED_FLAG | CertStoreFlags.CERT_STORE_CREATE_NEW_FLAG, null);
258 if (safeCertStoreHandle.IsInvalid)
259 {
260 throw Marshal.GetHRForLastWin32Error().ToCryptographicException();
261 }
262 if (!global::Interop.crypt32.CertAddCertificateLinkToStore(safeCertStoreHandle, certificatePal.CertContext, CertStoreAddDisposition.CERT_STORE_ADD_ALWAYS, IntPtr.Zero))
263 {
264 throw Marshal.GetHRForLastWin32Error().ToCryptographicException();
265 }
266 return new StorePal(safeCertStoreHandle);
267 }
StorePal(SafeCertStoreHandle certStore)
Definition StorePal.cs:89
static readonly IntPtr Zero
Definition IntPtr.cs:18

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

Referenced by Internal.Cryptography.Pal.CertificatePal.Export().