12 private const uint X509_STORE_CONTENT_FLAGS = 5938u;
34 base.List[index] = value;
71 if (certificate ==
null)
75 return base.List.Add(certificate);
84 if (certificates ==
null)
91 for (; i < certificates.Length; i++)
98 for (
int j = 0; j < i; j++)
112 if (certificates ==
null)
129 for (
int i = 0; i < num; i++)
145 if (certificate ==
null)
149 return base.List.Contains(certificate);
163 if (certificate ==
null)
167 base.List.Insert(index, certificate);
183 if (certificate ==
null)
187 base.List.Remove(certificate);
196 if (certificates ==
null)
203 for (; i < certificates.Length; i++)
210 for (
int j = 0; j < i; j++)
212 Add(certificates[j]);
224 if (certificates ==
null)
241 for (
int i = 0; i < num; i++)
243 Add(certificates[i]);
264 safeCertStoreHandle2.Dispose();
265 safeCertStoreHandle.Dispose();
288 invalidHandle.Dispose();
290 certificates.
CopyTo(array, 0);
313 invalidHandle.Dispose();
315 certificates.
CopyTo(array, 0);
324 return Export(contentType,
null);
337 byte[] result = ExportCertificatesToBlob(safeCertStoreHandle, contentType, password);
338 safeCertStoreHandle.Dispose();
347 CAPIBase.CRYPTOAPI_BLOB cRYPTOAPI_BLOB =
default(CAPIBase.CRYPTOAPI_BLOB);
348 SafeLocalAllocHandle safeLocalAllocHandle = SafeLocalAllocHandle.InvalidHandle;
352 safeCertContextHandle = CAPI.CertEnumCertificatesInStore(safeCertStoreHandle, safeCertContextHandle);
353 if (safeCertContextHandle !=
null && !safeCertContextHandle.IsInvalid)
355 CAPIBase.CERT_CONTEXT cERT_CONTEXT = *(CAPIBase.CERT_CONTEXT*)(
void*)safeCertContextHandle.DangerousGetHandle();
356 array =
new byte[cERT_CONTEXT.cbCertEncoded];
357 Marshal.
Copy(cERT_CONTEXT.pbCertEncoded, array, 0, array.Length);
362 safeCertContextHandle = CAPI.CertEnumCertificatesInStore(safeCertStoreHandle, safeCertContextHandle);
364 if (safeCertContextHandle !=
null && !safeCertContextHandle.IsInvalid)
366 if (!CAPISafe.CertSerializeCertificateStoreElement(safeCertContextHandle, 0u, safeLocalAllocHandle,
new IntPtr(&num)))
370 safeLocalAllocHandle = CAPI.LocalAlloc(0u,
new IntPtr(num));
371 if (!CAPISafe.CertSerializeCertificateStoreElement(safeCertContextHandle, 0u, safeLocalAllocHandle,
new IntPtr(&num)))
375 array =
new byte[num];
376 Marshal.
Copy(safeLocalAllocHandle.DangerousGetHandle(), array, 0, array.Length);
381 if (!CAPI.PFXExportCertStore(safeCertStoreHandle,
new IntPtr(&cRYPTOAPI_BLOB), password, 6u))
385 safeLocalAllocHandle = CAPI.LocalAlloc(0u,
new IntPtr(cRYPTOAPI_BLOB.cbData));
386 cRYPTOAPI_BLOB.pbData = safeLocalAllocHandle.DangerousGetHandle();
387 if (!CAPI.PFXExportCertStore(safeCertStoreHandle,
new IntPtr(&cRYPTOAPI_BLOB), password, 6u))
391 array =
new byte[cRYPTOAPI_BLOB.cbData];
392 Marshal.
Copy(cRYPTOAPI_BLOB.pbData, array, 0, array.Length);
398 if (!CAPI.CertSaveStore(safeCertStoreHandle, 65537u, dwSaveAs, 2u,
new IntPtr(&cRYPTOAPI_BLOB), 0u))
402 safeLocalAllocHandle = CAPI.LocalAlloc(0u,
new IntPtr(cRYPTOAPI_BLOB.cbData));
403 cRYPTOAPI_BLOB.pbData = safeLocalAllocHandle.DangerousGetHandle();
404 if (!CAPI.CertSaveStore(safeCertStoreHandle, 65537u, dwSaveAs, 2u,
new IntPtr(&cRYPTOAPI_BLOB), 0u))
408 array =
new byte[cRYPTOAPI_BLOB.cbData];
409 Marshal.
Copy(cRYPTOAPI_BLOB.pbData, array, 0, array.Length);
412 throw new CryptographicException(SR.GetString(
"Cryptography_X509_InvalidContentType"));
414 safeLocalAllocHandle.Dispose();
415 safeCertContextHandle.Dispose();
421 if (findValue ==
null)
423 throw new ArgumentNullException(
"findValue");
425 IntPtr pvFindPara = IntPtr.Zero;
427 object pvCallbackData =
null;
428 FindProcDelegate pfnCertCallback =
null;
429 FindProcDelegate pfnCertCallback2 =
null;
430 uint dwFindType = 0u;
431 CAPIBase.CRYPTOAPI_BLOB cRYPTOAPI_BLOB =
default(CAPIBase.CRYPTOAPI_BLOB);
432 SafeLocalAllocHandle safeLocalAllocHandle = SafeLocalAllocHandle.InvalidHandle;
439 if (findValue.GetType() != typeof(
string))
441 throw new CryptographicException(SR.GetString(
"Cryptography_X509_InvalidFindValue"));
445 cRYPTOAPI_BLOB.pbData = safeLocalAllocHandle.DangerousGetHandle();
446 cRYPTOAPI_BLOB.cbData = (uint)array2.Length;
448 pvFindPara =
new IntPtr(&cRYPTOAPI_BLOB);
453 if (findValue.GetType() != typeof(
string))
455 throw new CryptographicException(SR.GetString(
"Cryptography_X509_InvalidFindValue"));
457 string text2 = (string)findValue;
458 dwFindType = 524295u;
460 pvFindPara = safeLocalAllocHandle.DangerousGetHandle();
465 if (findValue.GetType() != typeof(
string))
467 throw new CryptographicException(SR.GetString(
"Cryptography_X509_InvalidFindValue"));
469 string text2 = (string)findValue;
470 pfnCertCallback = FindSubjectDistinguishedNameCallback;
476 if (findValue.GetType() != typeof(
string))
478 throw new CryptographicException(SR.GetString(
"Cryptography_X509_InvalidFindValue"));
480 string s = (string)findValue;
481 dwFindType = 524292u;
483 pvFindPara = safeLocalAllocHandle.DangerousGetHandle();
488 if (findValue.GetType() != typeof(
string))
490 throw new CryptographicException(SR.GetString(
"Cryptography_X509_InvalidFindValue"));
492 string s = (string)findValue;
493 pfnCertCallback = FindIssuerDistinguishedNameCallback;
499 if (findValue.GetType() != typeof(
string))
501 throw new CryptographicException(SR.GetString(
"Cryptography_X509_InvalidFindValue"));
503 pfnCertCallback = FindSerialNumberCallback;
504 pfnCertCallback2 = FindSerialNumberCallback;
505 BigInt bigInt =
new BigInt();
506 bigInt.FromHexadecimal((
string)findValue);
507 obj = bigInt.ToByteArray();
508 bigInt.FromDecimal((
string)findValue);
509 pvCallbackData = bigInt.ToByteArray();
513 if (findValue.GetType() != typeof(DateTime))
515 throw new CryptographicException(SR.GetString(
"Cryptography_X509_InvalidFindValue"));
517 *(
long*)(&fILETIME) = ((
DateTime)findValue).ToFileTime();
518 pfnCertCallback = FindTimeValidCallback;
522 if (findValue.GetType() != typeof(DateTime))
524 throw new CryptographicException(SR.GetString(
"Cryptography_X509_InvalidFindValue"));
526 *(
long*)(&fILETIME) = ((
DateTime)findValue).ToFileTime();
527 pfnCertCallback = FindTimeNotBeforeCallback;
531 if (findValue.GetType() != typeof(DateTime))
533 throw new CryptographicException(SR.GetString(
"Cryptography_X509_InvalidFindValue"));
535 *(
long*)(&fILETIME) = ((
DateTime)findValue).ToFileTime();
536 pfnCertCallback = FindTimeNotAfterCallback;
540 if (findValue.GetType() != typeof(
string))
542 throw new CryptographicException(SR.GetString(
"Cryptography_X509_InvalidFindValue"));
544 obj = (string)findValue;
545 pfnCertCallback = FindTemplateNameCallback;
548 if (findValue.GetType() != typeof(
string))
550 throw new CryptographicException(SR.GetString(
"Cryptography_X509_InvalidFindValue"));
555 text = (string)findValue;
559 pfnCertCallback = FindApplicationPolicyCallback;
562 if (findValue.GetType() != typeof(
string))
564 throw new CryptographicException(SR.GetString(
"Cryptography_X509_InvalidFindValue"));
569 text = (string)findValue;
573 pfnCertCallback = FindCertificatePolicyCallback;
576 if (findValue.GetType() != typeof(
string))
578 throw new CryptographicException(SR.GetString(
"Cryptography_X509_InvalidFindValue"));
583 text = (string)findValue;
587 pfnCertCallback = FindExtensionCallback;
590 if (findValue.GetType() == typeof(
string))
592 CAPIBase.KEY_USAGE_STRUCT[] array =
new CAPIBase.KEY_USAGE_STRUCT[9]
594 new CAPIBase.KEY_USAGE_STRUCT(
"DigitalSignature", 128u),
595 new CAPIBase.KEY_USAGE_STRUCT(
"NonRepudiation", 64u),
596 new CAPIBase.KEY_USAGE_STRUCT(
"KeyEncipherment", 32u),
597 new CAPIBase.KEY_USAGE_STRUCT(
"DataEncipherment", 16u),
598 new CAPIBase.KEY_USAGE_STRUCT(
"KeyAgreement", 8u),
599 new CAPIBase.KEY_USAGE_STRUCT(
"KeyCertSign", 4u),
600 new CAPIBase.KEY_USAGE_STRUCT(
"CrlSign", 2u),
601 new CAPIBase.KEY_USAGE_STRUCT(
"EncipherOnly", 1u),
602 new CAPIBase.KEY_USAGE_STRUCT(
"DecipherOnly", 32768u)
604 for (uint num = 0u; num < array.Length; num++)
606 if (
string.Compare(array[num].pwszKeyUsage, (
string)findValue,
StringComparison.OrdinalIgnoreCase) == 0)
608 obj = array[num].dwKeyUsageBit;
614 throw new CryptographicException(SR.GetString(
"Cryptography_X509_InvalidFindType"));
623 if (!(findValue.GetType() == typeof(uint)) && !(findValue.GetType() == typeof(
int)))
625 throw new CryptographicException(SR.GetString(
"Cryptography_X509_InvalidFindType"));
629 pfnCertCallback = FindKeyUsageCallback;
632 if (findValue.GetType() != typeof(
string))
634 throw new CryptographicException(SR.GetString(
"Cryptography_X509_InvalidFindValue"));
637 pfnCertCallback = FindSubjectKeyIdentifierCallback;
640 throw new CryptographicException(SR.GetString(
"Cryptography_X509_InvalidFindType"));
643 if (safeCertStoreHandle ==
null || safeCertStoreHandle.IsInvalid)
647 FindByCert(safeSourceStoreHandle, dwFindType, pvFindPara, validOnly, pfnCertCallback, pfnCertCallback2, obj, pvCallbackData, safeCertStoreHandle);
648 safeLocalAllocHandle.Dispose();
649 return safeCertStoreHandle;
656 for (invalidHandle = CAPI.CertFindCertificateInStore(safeSourceStoreHandle, 65537u, 0u, dwFindType, pvFindPara, invalidHandle); invalidHandle !=
null && !invalidHandle.IsInvalid; GC.SuppressFinalize(invalidHandle), invalidHandle = CAPI.CertFindCertificateInStore(safeSourceStoreHandle, 65537u, 0u, dwFindType, pvFindPara, invalidHandle))
658 if (pfnCertCallback1 !=
null)
660 num = pfnCertCallback1(invalidHandle, pvCallbackData1);
663 if (pfnCertCallback2 !=
null)
665 num = pfnCertCallback2(invalidHandle, pvCallbackData2);
679 num =
System.
Security.
Cryptography.
X509Certificates.
X509Utils.VerifyCertificate(invalidHandle,
null,
null,
X509RevocationMode.NoCheck,
X509RevocationFlag.ExcludeRoot,
DateTime.Now,
new TimeSpan(0, 0, 0),
null,
new IntPtr(1L), IntPtr.Zero);
695 if (invalidHandle !=
null && !invalidHandle.IsInvalid)
697 invalidHandle.Dispose();
699 if (num != 1 && num != 0)
701 throw new CryptographicException(num);
707 string certNameInfo = CAPI.GetCertNameInfo(safeCertContextHandle, 0u, 2u);
708 if (
string.Compare(certNameInfo, (
string)pvCallbackData,
StringComparison.OrdinalIgnoreCase) != 0)
717 string certNameInfo = CAPI.GetCertNameInfo(safeCertContextHandle, 1u, 2u);
718 if (
string.Compare(certNameInfo, (
string)pvCallbackData,
StringComparison.OrdinalIgnoreCase) != 0)
727 CAPIBase.CERT_CONTEXT cERT_CONTEXT = *(CAPIBase.CERT_CONTEXT*)(
void*)safeCertContextHandle.DangerousGetHandle();
728 CAPIBase.CERT_INFO cERT_INFO = (CAPIBase.CERT_INFO)
Marshal.
PtrToStructure(cERT_CONTEXT.pCertInfo, typeof(CAPIBase.CERT_INFO));
729 byte[] array =
new byte[cERT_INFO.SerialNumber.cbData];
730 Marshal.
Copy(cERT_INFO.SerialNumber.pbData, array, 0, array.Length);
732 byte[] array2 = (
byte[])pvCallbackData;
733 if (array2.Length != hexArraySize)
737 for (
int i = 0; i < array2.Length; i++)
739 if (array2[i] != array[i])
750 CAPIBase.CERT_CONTEXT cERT_CONTEXT = *(CAPIBase.CERT_CONTEXT*)(
void*)safeCertContextHandle.DangerousGetHandle();
751 if (CAPISafe.CertVerifyTimeValidity(ref pTimeToVerify, cERT_CONTEXT.pCertInfo) == 0)
761 CAPIBase.CERT_CONTEXT cERT_CONTEXT = *(CAPIBase.CERT_CONTEXT*)(
void*)safeCertContextHandle.DangerousGetHandle();
762 if (CAPISafe.CertVerifyTimeValidity(ref pTimeToVerify, cERT_CONTEXT.pCertInfo) == 1)
772 CAPIBase.CERT_CONTEXT cERT_CONTEXT = *(CAPIBase.CERT_CONTEXT*)(
void*)safeCertContextHandle.DangerousGetHandle();
773 if (CAPISafe.CertVerifyTimeValidity(ref pTimeToVerify, cERT_CONTEXT.pCertInfo) == -1)
782 IntPtr zero = IntPtr.Zero;
783 IntPtr zero2 = IntPtr.Zero;
784 CAPIBase.CERT_CONTEXT cERT_CONTEXT = *(CAPIBase.CERT_CONTEXT*)(
void*)safeCertContextHandle.DangerousGetHandle();
785 CAPIBase.CERT_INFO cERT_INFO = (CAPIBase.CERT_INFO)
Marshal.
PtrToStructure(cERT_CONTEXT.pCertInfo, typeof(CAPIBase.CERT_INFO));
786 zero = CAPISafe.CertFindExtension(
"1.3.6.1.4.1.311.20.2", cERT_INFO.cExtension, cERT_INFO.rgExtension);
787 zero2 = CAPISafe.CertFindExtension(
"1.3.6.1.4.1.311.21.7", cERT_INFO.cExtension, cERT_INFO.rgExtension);
788 if (zero == IntPtr.Zero && zero2 == IntPtr.Zero)
792 if (zero != IntPtr.Zero)
794 CAPIBase.CERT_EXTENSION cERT_EXTENSION = (CAPIBase.CERT_EXTENSION)
Marshal.
PtrToStructure(zero, typeof(CAPIBase.CERT_EXTENSION));
795 byte[] array =
new byte[cERT_EXTENSION.Value.cbData];
796 Marshal.
Copy(cERT_EXTENSION.Value.pbData, array, 0, array.Length);
797 uint cbDecodedValue = 0u;
798 SafeLocalAllocHandle decodedValue =
null;
799 if (CAPI.DecodeObject(
new IntPtr(24L), array, out decodedValue, out cbDecodedValue))
801 CAPIBase.CERT_NAME_VALUE cERT_NAME_VALUE = (CAPIBase.CERT_NAME_VALUE)
Marshal.
PtrToStructure(decodedValue.DangerousGetHandle(), typeof(CAPIBase.CERT_NAME_VALUE));
803 if (
string.Compare(strA, (
string)pvCallbackData,
StringComparison.OrdinalIgnoreCase) == 0)
809 if (zero2 != IntPtr.Zero)
811 CAPIBase.CERT_EXTENSION cERT_EXTENSION2 = (CAPIBase.CERT_EXTENSION)
Marshal.
PtrToStructure(zero2, typeof(CAPIBase.CERT_EXTENSION));
812 byte[] array2 =
new byte[cERT_EXTENSION2.Value.cbData];
813 Marshal.
Copy(cERT_EXTENSION2.Value.pbData, array2, 0, array2.Length);
814 uint cbDecodedValue2 = 0u;
815 SafeLocalAllocHandle decodedValue2 =
null;
816 if (CAPI.DecodeObject(
new IntPtr(64L), array2, out decodedValue2, out cbDecodedValue2))
818 CAPIBase.CERT_TEMPLATE_EXT cERT_TEMPLATE_EXT = (CAPIBase.CERT_TEMPLATE_EXT)
Marshal.
PtrToStructure(decodedValue2.DangerousGetHandle(), typeof(CAPIBase.CERT_TEMPLATE_EXT));
822 text = (string)pvCallbackData;
824 if (
string.Compare(cERT_TEMPLATE_EXT.pszObjId, text,
StringComparison.OrdinalIgnoreCase) == 0)
835 string text = (string)pvCallbackData;
836 if (text.Length == 0)
840 IntPtr intPtr = safeCertContextHandle.DangerousGetHandle();
843 SafeLocalAllocHandle invalidHandle = SafeLocalAllocHandle.InvalidHandle;
844 if (!CAPISafe.CertGetValidUsages(1u,
new IntPtr(&intPtr),
new IntPtr(&num), invalidHandle,
new IntPtr(&num2)))
848 invalidHandle = CAPI.LocalAlloc(0u,
new IntPtr(num2));
849 if (!CAPISafe.CertGetValidUsages(1u,
new IntPtr(&intPtr),
new IntPtr(&num), invalidHandle,
new IntPtr(&num2)))
857 for (
int i = 0; i < num; i++)
871 string text = (string)pvCallbackData;
872 if (text.Length == 0)
876 CAPIBase.CERT_CONTEXT cERT_CONTEXT = *(CAPIBase.CERT_CONTEXT*)(
void*)safeCertContextHandle.DangerousGetHandle();
877 CAPIBase.CERT_INFO cERT_INFO = (CAPIBase.CERT_INFO)
Marshal.
PtrToStructure(cERT_CONTEXT.pCertInfo, typeof(CAPIBase.CERT_INFO));
878 IntPtr intPtr = CAPISafe.CertFindExtension(
"2.5.29.32", cERT_INFO.cExtension, cERT_INFO.rgExtension);
879 if (intPtr == IntPtr.Zero)
883 CAPIBase.CERT_EXTENSION cERT_EXTENSION = (CAPIBase.CERT_EXTENSION)
Marshal.
PtrToStructure(intPtr, typeof(CAPIBase.CERT_EXTENSION));
884 byte[] array =
new byte[cERT_EXTENSION.Value.cbData];
885 Marshal.
Copy(cERT_EXTENSION.Value.pbData, array, 0, array.Length);
886 uint cbDecodedValue = 0u;
887 SafeLocalAllocHandle decodedValue =
null;
888 if (CAPI.DecodeObject(
new IntPtr(16L), array, out decodedValue, out cbDecodedValue))
890 CAPIBase.CERT_POLICIES_INFO cERT_POLICIES_INFO = (CAPIBase.CERT_POLICIES_INFO)
Marshal.
PtrToStructure(decodedValue.DangerousGetHandle(), typeof(CAPIBase.CERT_POLICIES_INFO));
891 for (
int i = 0; i < cERT_POLICIES_INFO.cPolicyInfo; i++)
893 IntPtr ptr =
new IntPtr((
long)cERT_POLICIES_INFO.rgPolicyInfo + i *
Marshal.
SizeOf(typeof(CAPIBase.CERT_POLICY_INFO)));
894 CAPIBase.CERT_POLICY_INFO cERT_POLICY_INFO = (CAPIBase.CERT_POLICY_INFO)
Marshal.
PtrToStructure(ptr, typeof(CAPIBase.CERT_POLICY_INFO));
895 if (
string.Compare(text, cERT_POLICY_INFO.pszPolicyIdentifier,
StringComparison.OrdinalIgnoreCase) == 0)
906 CAPIBase.CERT_CONTEXT cERT_CONTEXT = *(CAPIBase.CERT_CONTEXT*)(
void*)safeCertContextHandle.DangerousGetHandle();
907 CAPIBase.CERT_INFO cERT_INFO = (CAPIBase.CERT_INFO)
Marshal.
PtrToStructure(cERT_CONTEXT.pCertInfo, typeof(CAPIBase.CERT_INFO));
908 IntPtr value = CAPISafe.CertFindExtension((
string)pvCallbackData, cERT_INFO.cExtension, cERT_INFO.rgExtension);
909 if (value == IntPtr.Zero)
918 CAPIBase.CERT_CONTEXT cERT_CONTEXT = *(CAPIBase.CERT_CONTEXT*)(
void*)safeCertContextHandle.DangerousGetHandle();
920 if (!CAPISafe.CertGetIntendedKeyUsage(65537u, cERT_CONTEXT.pCertInfo,
new IntPtr(&num), 4u))
924 uint num2 =
Convert.ToUInt32(pvCallbackData,
null);
925 if ((num & num2) == num2)
934 SafeLocalAllocHandle invalidHandle = SafeLocalAllocHandle.InvalidHandle;
936 if (!CAPISafe.CertGetCertificateContextProperty(safeCertContextHandle, 20u, invalidHandle, ref pcbData))
940 invalidHandle = CAPI.LocalAlloc(0u,
new IntPtr(pcbData));
941 if (!CAPISafe.CertGetCertificateContextProperty(safeCertContextHandle, 20u, invalidHandle, ref pcbData))
945 byte[] array = (
byte[])pvCallbackData;
946 if (array.Length != pcbData)
950 byte[] array2 =
new byte[pcbData];
951 Marshal.
Copy(invalidHandle.DangerousGetHandle(), array2, 0, array2.Length);
952 invalidHandle.Dispose();
953 for (uint num = 0u; num < pcbData; num++)
955 if (array[num] != array2[num])
967 if (!CAPI.CryptQueryObject(2u, rawData, 5938u, 14u, 0u, IntPtr.Zero,
new IntPtr(&num), IntPtr.Zero, ref phCertStore, IntPtr.Zero, IntPtr.Zero))
973 phCertStore.Dispose();
974 phCertStore = CAPI.PFXImportCertStore(2u, rawData, password, dwFlags, persistKeyContainers);
976 if (phCertStore ==
null || phCertStore.IsInvalid)
987 if (!CAPI.CryptQueryObject(1u, fileName, 5938u, 14u, 0u, IntPtr.Zero,
new IntPtr(&num), IntPtr.Zero, ref phCertStore, IntPtr.Zero, IntPtr.Zero))
993 phCertStore.Dispose();
994 phCertStore = CAPI.PFXImportCertStore(1u, fileName, password, dwFlags, persistKeyContainers);
996 if (phCertStore ==
null || phCertStore.IsInvalid)
The exception that is thrown when an error occurs during a cryptographic operation.
void AddRange(X509Certificate2[] certificates)
Adds multiple T:System.Security.Cryptography.X509Certificates.X509Certificate2 objects in an array to...
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
void Import(byte[] rawData, string password, X509KeyStorageFlags keyStorageFlags)
Imports a certificate, in the form of a byte array that requires a password to access the certificate...
bool Contains(X509Certificate2 certificate)
Determines whether the T:System.Security.Cryptography.X509Certificates.X509Certificate2Collection obj...
StringComparison
Specifies the culture, case, and sort rules to be used by certain overloads of the M:System....
X509Certificate2Collection()
Initializes a new instance of the T:System.Security.Cryptography.X509Certificates....
Defines a collection that stores T:System.Security.Cryptography.X509Certificates.X509Certificate obje...
X509Certificate2Collection(X509Certificate2[] certificates)
Initializes a new instance of the T:System.Security.Cryptography.X509Certificates....
byte [] Export(X509ContentType contentType, string password)
Exports X.509 certificate information into a byte array using a password.
static int SizeOf(object structure)
Returns the unmanaged size of an object in bytes.
static int GetHRForLastWin32Error()
Returns the HRESULT corresponding to the last error incurred by Win32 code executed using T:System....
void Remove(X509Certificate2 certificate)
Removes the first occurrence of a certificate from the T:System.Security.Cryptography....
byte [] Export(X509ContentType contentType)
Exports X.509 certificate information into a byte array.
X509ContentType
Specifies the format of an X.509 certificate.
new X509Certificate2Enumerator GetEnumerator()
Returns an enumerator that can iterate through a T:System.Security.Cryptography.X509Certificates....
A type representing a date and time value.
X509RevocationMode
Specifies the mode used to check for X509 certificate revocation.
static void Copy(int[] source, int startIndex, IntPtr destination, int length)
Copies data from a one-dimensional, managed 32-bit signed integer array to an unmanaged memory pointe...
void RemoveRange(X509Certificate2Collection certificates)
Removes multiple T:System.Security.Cryptography.X509Certificates.X509Certificate2 objects in an T:Sys...
A cast or conversion operation, such as (SampleType)obj in C::or CType(obj, SampleType) in Visual Bas...
void CopyTo(X509Certificate[] array, int index)
Copies the T:System.Security.Cryptography.X509Certificates.X509Certificate values in the current T:Sy...
X509Certificate2 Current
Gets the current element in the T:System.Security.Cryptography.X509Certificates.X509Certificate2Colle...
Controls access to stores containing X.509 certificates. This class cannot be inherited.
void Import(string fileName, string password, X509KeyStorageFlags keyStorageFlags)
Imports a certificate file that requires a password into a T:System.Security.Cryptography....
A platform-specific type that is used to represent a pointer or a handle.
void Import(string fileName)
Imports a certificate file into a T:System.Security.Cryptography.X509Certificates....
Provides a collection of methods for allocating unmanaged memory, copying unmanaged memory blocks,...
void AddRange(X509Certificate2Collection certificates)
Adds multiple T:System.Security.Cryptography.X509Certificates.X509Certificate2 objects in an T:System...
StorePermissionFlags
Specifies the permitted access to X.509 certificate stores.
X509FindType
Specifies the type of value the M:System.Security.Cryptography.X509Certificates.X509Certificate2Colle...
int Count
Gets the number of elements contained in the T:System.Collections.CollectionBase instance....
static unsafe string PtrToStringUni(IntPtr ptr, int len)
Allocates a managed T:System.String and copies a specified number of characters from an unmanaged Uni...
X509Certificate2Collection(X509Certificate2Collection certificates)
Initializes a new instance of the T:System.Security.Cryptography.X509Certificates....
X509Certificate2Collection(X509Certificate2 certificate)
Initializes a new instance of the T:System.Security.Cryptography.X509Certificates....
Represents the number of 100-nanosecond intervals since January 1, 1601. This structure is a 64-bit v...
bool MoveNext()
Advances the enumerator to the next element in the T:System.Security.Cryptography....
static void PtrToStructure(IntPtr ptr, object structure)
Marshals data from an unmanaged block of memory to a managed object.
void RemoveRange(X509Certificate2[] certificates)
Removes multiple T:System.Security.Cryptography.X509Certificates.X509Certificate2 objects in an array...
void Insert(int index, X509Certificate2 certificate)
Inserts an object into the T:System.Security.Cryptography.X509Certificates.X509Certificate2Collection...
int Add(X509Certificate2 certificate)
Adds an object to the end of the T:System.Security.Cryptography.X509Certificates.X509Certificate2Coll...
X509KeyStorageFlags
Defines where and how to import the private key of an X.509 certificate.
X509KeyUsageFlags
Defines how the certificate key can be used. If this value is not defined, the key can be used for an...
void Import(byte[] rawData)
Imports a certificate in the form of a byte array into a T:System.Security.Cryptography....
void Assert()
Declares that the calling code can access the resource protected by a permission demand through the c...
static int GetLastWin32Error()
Returns the error code returned by the last unmanaged function that was called using platform invoke ...
static unsafe string PtrToStringAnsi(IntPtr ptr)
Copies all characters up to the first null character from an unmanaged ANSI string to a managed T:Sys...
Represents a collection of T:System.Security.Cryptography.X509Certificates.X509Certificate2 objects....
Supports a simple iteration over a T:System.Security.Cryptography.X509Certificates....
X509RevocationFlag
Specifies which X509 certificates in the chain should be checked for revocation.
X509Certificate2Collection Find(X509FindType findType, object findValue, bool validOnly)
Searches an T:System.Security.Cryptography.X509Certificates.X509Certificate2Collection object using t...
static IntPtr ReadIntPtr([In] [MarshalAs(UnmanagedType.AsAny)] object ptr, int ofs)
Reads a processor native sized integer from unmanaged memory.
Represents an X.509 certificate.