This commit is contained in:
niko
2026-06-04 11:42:34 +02:00
parent f39ba70a9f
commit e720b98cd1
7488 changed files with 2493818 additions and 0 deletions
@@ -0,0 +1,928 @@
using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Text;
using Mono.Security.Authenticode;
using Mono.Security.X509;
namespace System.Security.Cryptography.X509Certificates
{
/// <summary>Provides methods that help you use X.509 v.3 certificates.</summary>
// Token: 0x020004E1 RID: 1249
[MonoTODO("X509ContentType.SerializedCert isn't supported (anywhere in the class)")]
[ComVisible(true)]
[Serializable]
public class X509Certificate : ISerializable, IDeserializationCallback
{
// Token: 0x06002E42 RID: 11842 RVA: 0x0009442C File Offset: 0x0009262C
internal X509Certificate(byte[] data, bool dates)
{
if (data != null)
{
this.Import(data, null, X509KeyStorageFlags.DefaultKeySet);
this.hideDates = !dates;
}
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> class defined from a sequence of bytes representing an X.509v3 certificate.</summary>
/// <param name="data">A byte array containing data from an X.509 certificate.</param>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">An error with the certificate occurs. For example:The certificate file does not exist.The certificate is invalid.The certificate's password is incorrect.</exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="rawData" /> parameter is null.-or-The length of the <paramref name="rawData" /> parameter is 0.</exception>
// Token: 0x06002E43 RID: 11843 RVA: 0x00094458 File Offset: 0x00092658
public X509Certificate(byte[] data)
: this(data, true)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> class using a handle to an unmanaged PCCERT_CONTEXT structure.</summary>
/// <param name="handle">A handle to an unmanaged PCCERT_CONTEXT structure.</param>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">An error with the certificate occurs. For example:The certificate file does not exist.The certificate is invalid.The certificate's password is incorrect.</exception>
/// <exception cref="T:System.ArgumentException">The handle parameter does not represent a valid PCCERT_CONTEXT structure.</exception>
// Token: 0x06002E44 RID: 11844 RVA: 0x00094464 File Offset: 0x00092664
public X509Certificate(IntPtr handle)
{
if (handle == IntPtr.Zero)
{
throw new ArgumentException("Invalid handle.");
}
throw new NotSupportedException();
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> class using another <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> class.</summary>
/// <param name="cert">A <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> class from which to initialize this class. </param>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">An error with the certificate occurs. For example:The certificate file does not exist.The certificate is invalid.The certificate's password is incorrect.</exception>
/// <exception cref="T:System.ArgumentNullException">The value of the <paramref name="cert" /> parameter is null.</exception>
// Token: 0x06002E45 RID: 11845 RVA: 0x00094498 File Offset: 0x00092698
public X509Certificate(X509Certificate cert)
{
if (cert == null)
{
throw new ArgumentNullException("cert");
}
if (cert != null)
{
byte[] rawCertData = cert.GetRawCertData();
if (rawCertData != null)
{
this.x509 = new X509Certificate(rawCertData);
}
this.hideDates = false;
}
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> class. </summary>
// Token: 0x06002E46 RID: 11846 RVA: 0x000944E4 File Offset: 0x000926E4
public X509Certificate()
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> class using a byte array and a password.</summary>
/// <param name="rawData">A byte array containing data from an X.509 certificate.</param>
/// <param name="password">The password required to access the X.509 certificate data.</param>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">An error with the certificate occurs. For example:The certificate file does not exist.The certificate is invalid.The certificate's password is incorrect.</exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="rawData" /> parameter is null.-or-The length of the <paramref name="rawData" /> parameter is 0.</exception>
// Token: 0x06002E47 RID: 11847 RVA: 0x000944EC File Offset: 0x000926EC
public X509Certificate(byte[] rawData, string password)
{
this.Import(rawData, password, X509KeyStorageFlags.DefaultKeySet);
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> class using a byte array and a password.</summary>
/// <param name="rawData">A byte array that contains data from an X.509 certificate.</param>
/// <param name="password">The password required to access the X.509 certificate data.</param>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">An error with the certificate occurs. For example:The certificate file does not exist.The certificate is invalid.The certificate's password is incorrect.</exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="rawData" /> parameter is null.-or-The length of the <paramref name="rawData" /> parameter is 0.</exception>
// Token: 0x06002E48 RID: 11848 RVA: 0x00094500 File Offset: 0x00092700
[MonoTODO("SecureString support is incomplete")]
public X509Certificate(byte[] rawData, SecureString password)
{
this.Import(rawData, password, X509KeyStorageFlags.DefaultKeySet);
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> class using a byte array, a password, and a key storage flag.</summary>
/// <param name="rawData">A byte array containing data from an X.509 certificate. </param>
/// <param name="password">The password required to access the X.509 certificate data. </param>
/// <param name="keyStorageFlags">One of the <see cref="T:System.Security.Cryptography.X509Certificates.X509KeyStorageFlags" /> values. </param>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">An error with the certificate occurs. For example:The certificate file does not exist.The certificate is invalid.The certificate's password is incorrect.</exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="rawData" /> parameter is null.-or-The length of the <paramref name="rawData" /> parameter is 0.</exception>
// Token: 0x06002E49 RID: 11849 RVA: 0x00094514 File Offset: 0x00092714
public X509Certificate(byte[] rawData, string password, X509KeyStorageFlags keyStorageFlags)
{
this.Import(rawData, password, keyStorageFlags);
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> class using a byte array, a password, and a key storage flag.</summary>
/// <param name="rawData">A byte array that contains data from an X.509 certificate. </param>
/// <param name="password">The password required to access the X.509 certificate data. </param>
/// <param name="keyStorageFlags">One of the <see cref="T:System.Security.Cryptography.X509Certificates.X509KeyStorageFlags" /> values that controls where and how to import the private key. </param>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">An error with the certificate occurs. For example:The certificate file does not exist.The certificate is invalid.The certificate's password is incorrect.</exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="rawData" /> parameter is null.-or-The length of the <paramref name="rawData" /> parameter is 0.</exception>
// Token: 0x06002E4A RID: 11850 RVA: 0x00094528 File Offset: 0x00092728
[MonoTODO("SecureString support is incomplete")]
public X509Certificate(byte[] rawData, SecureString password, X509KeyStorageFlags keyStorageFlags)
{
this.Import(rawData, password, keyStorageFlags);
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> class using the name of a PKCS7 signed file. </summary>
/// <param name="fileName">The name of a PKCS7 signed file.</param>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">An error with the certificate occurs. For example:The certificate file does not exist.The certificate is invalid.The certificate's password is incorrect.</exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="fileName" /> parameter is null.</exception>
// Token: 0x06002E4B RID: 11851 RVA: 0x0009453C File Offset: 0x0009273C
public X509Certificate(string fileName)
{
this.Import(fileName, null, X509KeyStorageFlags.DefaultKeySet);
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> class using the name of a PKCS7 signed file and a password to access the certificate.</summary>
/// <param name="fileName">The name of a PKCS7 signed file. </param>
/// <param name="password">The password required to access the X.509 certificate data. </param>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">An error with the certificate occurs. For example:The certificate file does not exist.The certificate is invalid.The certificate's password is incorrect.</exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="fileName" /> parameter is null.</exception>
// Token: 0x06002E4C RID: 11852 RVA: 0x00094550 File Offset: 0x00092750
public X509Certificate(string fileName, string password)
{
this.Import(fileName, password, X509KeyStorageFlags.DefaultKeySet);
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> class using a certificate file name and a password.</summary>
/// <param name="fileName">The name of a certificate file. </param>
/// <param name="password">The password required to access the X.509 certificate data. </param>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">An error with the certificate occurs. For example:The certificate file does not exist.The certificate is invalid.The certificate's password is incorrect.</exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="fileName" /> parameter is null.</exception>
// Token: 0x06002E4D RID: 11853 RVA: 0x00094564 File Offset: 0x00092764
[MonoTODO("SecureString support is incomplete")]
public X509Certificate(string fileName, SecureString password)
{
this.Import(fileName, password, X509KeyStorageFlags.DefaultKeySet);
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> class using the name of a PKCS7 signed file, a password to access the certificate, and a key storage flag. </summary>
/// <param name="fileName">The name of a PKCS7 signed file. </param>
/// <param name="password">The password required to access the X.509 certificate data. </param>
/// <param name="keyStorageFlags">One of the <see cref="T:System.Security.Cryptography.X509Certificates.X509KeyStorageFlags" /> values. </param>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">An error with the certificate occurs. For example:The certificate file does not exist.The certificate is invalid.The certificate's password is incorrect.</exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="fileName" /> parameter is null.</exception>
// Token: 0x06002E4E RID: 11854 RVA: 0x00094578 File Offset: 0x00092778
public X509Certificate(string fileName, string password, X509KeyStorageFlags keyStorageFlags)
{
this.Import(fileName, password, keyStorageFlags);
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> class using a certificate file name, a password, and a key storage flag. </summary>
/// <param name="fileName">The name of a certificate file. </param>
/// <param name="password">The password required to access the X.509 certificate data. </param>
/// <param name="keyStorageFlags">One of the <see cref="T:System.Security.Cryptography.X509Certificates.X509KeyStorageFlags" /> values that controls where and how to import the private key. </param>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">An error with the certificate occurs. For example:The certificate file does not exist.The certificate is invalid.The certificate's password is incorrect.</exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="fileName" /> parameter is null.</exception>
// Token: 0x06002E4F RID: 11855 RVA: 0x0009458C File Offset: 0x0009278C
[MonoTODO("SecureString support is incomplete")]
public X509Certificate(string fileName, SecureString password, X509KeyStorageFlags keyStorageFlags)
{
this.Import(fileName, password, keyStorageFlags);
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> class using a <see cref="T:System.Runtime.Serialization.SerializationInfo" /> object and a <see cref="T:System.Runtime.Serialization.StreamingContext" /> structure.</summary>
/// <param name="info">A <see cref="T:System.Runtime.Serialization.SerializationInfo" /> object that describes serialization information.</param>
/// <param name="context">A <see cref="T:System.Runtime.Serialization.StreamingContext" /> structure that describes how serialization should be performed.</param>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">An error with the certificate occurs. For example:The certificate file does not exist.The certificate is invalid.The certificate's password is incorrect.</exception>
// Token: 0x06002E50 RID: 11856 RVA: 0x000945A0 File Offset: 0x000927A0
public X509Certificate(SerializationInfo info, StreamingContext context)
{
byte[] array = (byte[])info.GetValue("RawData", typeof(byte[]));
this.Import(array, null, X509KeyStorageFlags.DefaultKeySet);
}
/// <summary>Implements the <see cref="T:System.Runtime.Serialization.ISerializable" /> interface and is called back by the deserialization event when deserialization is complete. </summary>
/// <param name="sender">The source of the deserialization event.</param>
// Token: 0x06002E51 RID: 11857 RVA: 0x000945D8 File Offset: 0x000927D8
void IDeserializationCallback.OnDeserialization(object sender)
{
}
/// <summary>Gets serialization information with all the data needed to recreate an instance of the current <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> object.</summary>
/// <param name="info">The object to populate with serialization information.</param>
/// <param name="context">The destination context of the serialization.</param>
// Token: 0x06002E52 RID: 11858 RVA: 0x000945DC File Offset: 0x000927DC
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue("RawData", this.x509.RawData);
}
// Token: 0x06002E53 RID: 11859 RVA: 0x000945F4 File Offset: 0x000927F4
private string tostr(byte[] data)
{
if (data != null)
{
StringBuilder stringBuilder = new StringBuilder();
for (int i = 0; i < data.Length; i++)
{
stringBuilder.Append(data[i].ToString("X2"));
}
return stringBuilder.ToString();
}
return null;
}
/// <summary>Creates an X.509v3 certificate using the name of a PKCS7 signed file.</summary>
/// <returns>The newly created X.509 certificate.</returns>
/// <param name="filename">The path of the PKCS7 signed file from which to create the X.509 certificate. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="filename" /> parameter is null. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.KeyContainerPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Create" />
/// </PermissionSet>
// Token: 0x06002E54 RID: 11860 RVA: 0x00094644 File Offset: 0x00092844
public static X509Certificate CreateFromCertFile(string filename)
{
byte[] array = X509Certificate.Load(filename);
return new X509Certificate(array);
}
/// <summary>Creates an X.509v3 certificate from the specified signed file.</summary>
/// <returns>The newly created X.509 certificate.</returns>
/// <param name="filename">The path of the signed file from which to create the X.509 certificate. </param>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.KeyContainerPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Create" />
/// </PermissionSet>
// Token: 0x06002E55 RID: 11861 RVA: 0x00094660 File Offset: 0x00092860
[MonoTODO("Incomplete - minimal validation in this version")]
public static X509Certificate CreateFromSignedFile(string filename)
{
try
{
AuthenticodeDeformatter authenticodeDeformatter = new AuthenticodeDeformatter(filename);
if (authenticodeDeformatter.SigningCertificate != null)
{
return new X509Certificate(authenticodeDeformatter.SigningCertificate.RawData);
}
}
catch (SecurityException)
{
throw;
}
catch (Exception ex)
{
string text = Locale.GetText("Couldn't extract digital signature from {0}.", new object[] { filename });
throw new COMException(text, ex);
}
throw new CryptographicException(Locale.GetText("{0} isn't signed.", new object[] { filename }));
}
// Token: 0x06002E56 RID: 11862 RVA: 0x00094714 File Offset: 0x00092914
private void InitFromHandle(IntPtr handle)
{
if (handle != IntPtr.Zero)
{
X509Certificate.CertificateContext certificateContext = (X509Certificate.CertificateContext)Marshal.PtrToStructure(handle, typeof(X509Certificate.CertificateContext));
byte[] array = new byte[certificateContext.cbCertEncoded];
Marshal.Copy(certificateContext.pbCertEncoded, array, 0, (int)certificateContext.cbCertEncoded);
this.x509 = new X509Certificate(array);
}
}
/// <summary>Compares two <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> objects for equality.</summary>
/// <returns>true if the current <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> object is equal to the object specified by the <paramref name="other" /> parameter; otherwise, false.</returns>
/// <param name="other">An <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> object to compare to the current object.</param>
// Token: 0x06002E57 RID: 11863 RVA: 0x00094778 File Offset: 0x00092978
public virtual bool Equals(X509Certificate other)
{
if (other == null)
{
return false;
}
if (other.x509 == null)
{
if (this.x509 == null)
{
return true;
}
throw new CryptographicException(Locale.GetText("Certificate instance is empty."));
}
else
{
byte[] rawData = other.x509.RawData;
if (rawData == null)
{
return this.x509 == null || this.x509.RawData == null;
}
if (this.x509 == null)
{
return false;
}
if (this.x509.RawData == null)
{
return false;
}
if (rawData.Length == this.x509.RawData.Length)
{
for (int i = 0; i < rawData.Length; i++)
{
if (rawData[i] != this.x509.RawData[i])
{
return false;
}
}
return true;
}
return false;
}
}
/// <summary>Returns the hash value for the X.509v3 certificate as an array of bytes.</summary>
/// <returns>The hash value for the X.509 certificate.</returns>
// Token: 0x06002E58 RID: 11864 RVA: 0x00094848 File Offset: 0x00092A48
public virtual byte[] GetCertHash()
{
if (this.x509 == null)
{
throw new CryptographicException(Locale.GetText("Certificate instance is empty."));
}
if (this.cachedCertificateHash == null && this.x509 != null)
{
SHA1 sha = SHA1.Create();
this.cachedCertificateHash = sha.ComputeHash(this.x509.RawData);
}
return this.cachedCertificateHash;
}
/// <summary>Returns the hash value for the X.509v3 certificate as a hexadecimal string.</summary>
/// <returns>The hexadecimal string representation of the X.509 certificate hash value.</returns>
// Token: 0x06002E59 RID: 11865 RVA: 0x000948AC File Offset: 0x00092AAC
public virtual string GetCertHashString()
{
return this.tostr(this.GetCertHash());
}
/// <summary>Returns the effective date of this X.509v3 certificate.</summary>
/// <returns>The effective date for this X.509 certificate.</returns>
// Token: 0x06002E5A RID: 11866 RVA: 0x000948BC File Offset: 0x00092ABC
public virtual string GetEffectiveDateString()
{
if (this.hideDates)
{
return null;
}
if (this.x509 == null)
{
throw new CryptographicException(Locale.GetText("Certificate instance is empty."));
}
return this.x509.ValidFrom.ToLocalTime().ToString();
}
/// <summary>Returns the expiration date of this X.509v3 certificate.</summary>
/// <returns>The expiration date for this X.509 certificate.</returns>
// Token: 0x06002E5B RID: 11867 RVA: 0x0009490C File Offset: 0x00092B0C
public virtual string GetExpirationDateString()
{
if (this.hideDates)
{
return null;
}
if (this.x509 == null)
{
throw new CryptographicException(Locale.GetText("Certificate instance is empty."));
}
return this.x509.ValidUntil.ToLocalTime().ToString();
}
/// <summary>Returns the name of the format of this X.509v3 certificate.</summary>
/// <returns>The format of this X.509 certificate.</returns>
// Token: 0x06002E5C RID: 11868 RVA: 0x0009495C File Offset: 0x00092B5C
public virtual string GetFormat()
{
return "X509";
}
/// <summary>Returns the hash code for the X.509v3 certificate as an integer.</summary>
/// <returns>The hash code for the X.509 certificate as an integer.</returns>
// Token: 0x06002E5D RID: 11869 RVA: 0x00094964 File Offset: 0x00092B64
public override int GetHashCode()
{
if (this.x509 == null)
{
return 0;
}
if (this.cachedCertificateHash == null)
{
this.GetCertHash();
}
if (this.cachedCertificateHash != null && this.cachedCertificateHash.Length >= 4)
{
return ((int)this.cachedCertificateHash[0] << 24) | ((int)this.cachedCertificateHash[1] << 16) | ((int)this.cachedCertificateHash[2] << 8) | (int)this.cachedCertificateHash[3];
}
return 0;
}
/// <summary>Returns the name of the certification authority that issued the X.509v3 certificate.</summary>
/// <returns>The name of the certification authority that issued the X.509 certificate.</returns>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">An error with the certificate occurs. For example:The certificate file does not exist.The certificate is invalid.The certificate's password is incorrect.</exception>
// Token: 0x06002E5E RID: 11870 RVA: 0x000949D8 File Offset: 0x00092BD8
[Obsolete("Use the Issuer property.")]
public virtual string GetIssuerName()
{
if (this.x509 == null)
{
throw new CryptographicException(Locale.GetText("Certificate instance is empty."));
}
return this.x509.IssuerName;
}
/// <summary>Returns the key algorithm information for this X.509v3 certificate.</summary>
/// <returns>The key algorithm information for this X.509 certificate as a string.</returns>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The certificate context is invalid.</exception>
// Token: 0x06002E5F RID: 11871 RVA: 0x00094A0C File Offset: 0x00092C0C
public virtual string GetKeyAlgorithm()
{
if (this.x509 == null)
{
throw new CryptographicException(Locale.GetText("Certificate instance is empty."));
}
return this.x509.KeyAlgorithm;
}
/// <summary>Returns the key algorithm parameters for the X.509v3 certificate.</summary>
/// <returns>The key algorithm parameters for the X.509 certificate as an array of bytes.</returns>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The certificate context is invalid.</exception>
// Token: 0x06002E60 RID: 11872 RVA: 0x00094A40 File Offset: 0x00092C40
public virtual byte[] GetKeyAlgorithmParameters()
{
if (this.x509 == null)
{
throw new CryptographicException(Locale.GetText("Certificate instance is empty."));
}
byte[] keyAlgorithmParameters = this.x509.KeyAlgorithmParameters;
if (keyAlgorithmParameters == null)
{
throw new CryptographicException(Locale.GetText("Parameters not part of the certificate"));
}
return keyAlgorithmParameters;
}
/// <summary>Returns the key algorithm parameters for the X.509v3 certificate.</summary>
/// <returns>The key algorithm parameters for the X.509 certificate as a hexadecimal string.</returns>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The certificate context is invalid.</exception>
// Token: 0x06002E61 RID: 11873 RVA: 0x00094A8C File Offset: 0x00092C8C
public virtual string GetKeyAlgorithmParametersString()
{
return this.tostr(this.GetKeyAlgorithmParameters());
}
/// <summary>Returns the name of the principal to which the certificate was issued.</summary>
/// <returns>The name of the principal to which the certificate was issued.</returns>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The certificate context is invalid.</exception>
// Token: 0x06002E62 RID: 11874 RVA: 0x00094A9C File Offset: 0x00092C9C
[Obsolete("Use the Subject property.")]
public virtual string GetName()
{
if (this.x509 == null)
{
throw new CryptographicException(Locale.GetText("Certificate instance is empty."));
}
return this.x509.SubjectName;
}
/// <summary>Returns the public key for the X.509v3 certificate.</summary>
/// <returns>The public key for the X.509 certificate as an array of bytes.</returns>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The certificate context is invalid.</exception>
// Token: 0x06002E63 RID: 11875 RVA: 0x00094AD0 File Offset: 0x00092CD0
public virtual byte[] GetPublicKey()
{
if (this.x509 == null)
{
throw new CryptographicException(Locale.GetText("Certificate instance is empty."));
}
return this.x509.PublicKey;
}
/// <summary>Returns the public key for the X.509v3 certificate.</summary>
/// <returns>The public key for the X.509 certificate as a hexadecimal string.</returns>
// Token: 0x06002E64 RID: 11876 RVA: 0x00094B04 File Offset: 0x00092D04
public virtual string GetPublicKeyString()
{
return this.tostr(this.GetPublicKey());
}
/// <summary>Returns the raw data for the entire X.509v3 certificate.</summary>
/// <returns>A byte array containing the X.509 certificate data.</returns>
// Token: 0x06002E65 RID: 11877 RVA: 0x00094B14 File Offset: 0x00092D14
public virtual byte[] GetRawCertData()
{
if (this.x509 == null)
{
throw new CryptographicException(Locale.GetText("Certificate instance is empty."));
}
return this.x509.RawData;
}
/// <summary>Returns the raw data for the entire X.509v3 certificate.</summary>
/// <returns>The X.509 certificate data as a hexadecimal string.</returns>
// Token: 0x06002E66 RID: 11878 RVA: 0x00094B48 File Offset: 0x00092D48
public virtual string GetRawCertDataString()
{
if (this.x509 == null)
{
throw new CryptographicException(Locale.GetText("Certificate instance is empty."));
}
return this.tostr(this.x509.RawData);
}
/// <summary>Returns the serial number of the X.509v3 certificate.</summary>
/// <returns>The serial number of the X.509 certificate as an array of bytes.</returns>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The certificate context is invalid.</exception>
// Token: 0x06002E67 RID: 11879 RVA: 0x00094B84 File Offset: 0x00092D84
public virtual byte[] GetSerialNumber()
{
if (this.x509 == null)
{
throw new CryptographicException(Locale.GetText("Certificate instance is empty."));
}
return this.x509.SerialNumber;
}
/// <summary>Returns the serial number of the X.509v3 certificate.</summary>
/// <returns>The serial number of the X.509 certificate as a hexadecimal string.</returns>
// Token: 0x06002E68 RID: 11880 RVA: 0x00094BB8 File Offset: 0x00092DB8
public virtual string GetSerialNumberString()
{
byte[] serialNumber = this.GetSerialNumber();
Array.Reverse(serialNumber);
return this.tostr(serialNumber);
}
/// <summary>Returns a string representation of the current <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> object.</summary>
/// <returns>A string representation of the current <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> object.</returns>
// Token: 0x06002E69 RID: 11881 RVA: 0x00094BDC File Offset: 0x00092DDC
public override string ToString()
{
return base.ToString();
}
/// <summary>Returns a string representation of the current <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> object, with extra information, if specified.</summary>
/// <returns>A string representation of the current <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> object.</returns>
/// <param name="fVerbose">true to produce the verbose form of the string representation; otherwise, false. </param>
// Token: 0x06002E6A RID: 11882 RVA: 0x00094BE4 File Offset: 0x00092DE4
public virtual string ToString(bool fVerbose)
{
if (!fVerbose || this.x509 == null)
{
return base.ToString();
}
string newLine = Environment.NewLine;
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.AppendFormat("[Subject]{0} {1}{0}{0}", newLine, this.Subject);
stringBuilder.AppendFormat("[Issuer]{0} {1}{0}{0}", newLine, this.Issuer);
stringBuilder.AppendFormat("[Not Before]{0} {1}{0}{0}", newLine, this.GetEffectiveDateString());
stringBuilder.AppendFormat("[Not After]{0} {1}{0}{0}", newLine, this.GetExpirationDateString());
stringBuilder.AppendFormat("[Thumbprint]{0} {1}{0}", newLine, this.GetCertHashString());
stringBuilder.Append(newLine);
return stringBuilder.ToString();
}
// Token: 0x06002E6B RID: 11883 RVA: 0x00094C84 File Offset: 0x00092E84
private static byte[] Load(string fileName)
{
byte[] array = null;
using (FileStream fileStream = File.OpenRead(fileName))
{
array = new byte[fileStream.Length];
fileStream.Read(array, 0, array.Length);
fileStream.Close();
}
return array;
}
/// <summary>Gets the name of the certificate authority that issued the X.509v3 certificate.</summary>
/// <returns>The name of the certificate authority that issued the X.509v3 certificate.</returns>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The certificate handle is invalid.</exception>
// Token: 0x17000927 RID: 2343
// (get) Token: 0x06002E6C RID: 11884 RVA: 0x00094CE8 File Offset: 0x00092EE8
public string Issuer
{
get
{
if (this.x509 == null)
{
throw new CryptographicException(Locale.GetText("Certificate instance is empty."));
}
if (this.issuer_name == null)
{
this.issuer_name = X501.ToString(this.x509.GetIssuerName(), true, ", ", true);
}
return this.issuer_name;
}
}
/// <summary>Gets the subject distinguished name from the certificate.</summary>
/// <returns>The subject distinguished name from the certificate.</returns>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The certificate handle is invalid.</exception>
// Token: 0x17000928 RID: 2344
// (get) Token: 0x06002E6D RID: 11885 RVA: 0x00094D40 File Offset: 0x00092F40
public string Subject
{
get
{
if (this.x509 == null)
{
throw new CryptographicException(Locale.GetText("Certificate instance is empty."));
}
if (this.subject_name == null)
{
this.subject_name = X501.ToString(this.x509.GetSubjectName(), true, ", ", true);
}
return this.subject_name;
}
}
/// <summary>Gets a handle to a Microsoft Cryptographic API certificate context described by an unmanaged PCCERT_CONTEXT structure. </summary>
/// <returns>An <see cref="T:System.IntPtr" /> structure that represents an unmanaged PCCERT_CONTEXT structure.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
/// </PermissionSet>
// Token: 0x17000929 RID: 2345
// (get) Token: 0x06002E6E RID: 11886 RVA: 0x00094D98 File Offset: 0x00092F98
[ComVisible(false)]
public IntPtr Handle
{
get
{
return IntPtr.Zero;
}
}
/// <summary>Compares two <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> objects for equality.</summary>
/// <returns>true if the current <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> object is equal to the object specified by the <paramref name="other" /> parameter; otherwise, false.</returns>
/// <param name="obj">An <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> object to compare to the current object. </param>
// Token: 0x06002E6F RID: 11887 RVA: 0x00094DA0 File Offset: 0x00092FA0
[ComVisible(false)]
public override bool Equals(object obj)
{
X509Certificate x509Certificate = obj as X509Certificate;
return x509Certificate != null && this.Equals(x509Certificate);
}
/// <summary>Exports the current <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> object to a byte array in a format described by one of the <see cref="T:System.Security.Cryptography.X509Certificates.X509ContentType" /> values. </summary>
/// <returns>An array of bytes that represents the current <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> object.</returns>
/// <param name="contentType">One of the <see cref="T:System.Security.Cryptography.X509Certificates.X509ContentType" /> values that describes how to format the output data. </param>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">A value other than <see cref="F:System.Security.Cryptography.X509Certificates.X509ContentType.Cert" />, <see cref="F:System.Security.Cryptography.X509Certificates.X509ContentType.SerializedCert" />, or <see cref="F:System.Security.Cryptography.X509Certificates.X509ContentType.Pkcs12" /> was passed to the <paramref name="contentType" /> parameter.-or-The certificate could not be exported.</exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.KeyContainerPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Open, Export" />
/// </PermissionSet>
// Token: 0x06002E70 RID: 11888 RVA: 0x00094DC4 File Offset: 0x00092FC4
[ComVisible(false)]
[MonoTODO("X509ContentType.Pfx/Pkcs12 and SerializedCert are not supported")]
public virtual byte[] Export(X509ContentType contentType)
{
return this.Export(contentType, null);
}
/// <summary>Exports the current <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> object to a byte array in a format described by one of the <see cref="T:System.Security.Cryptography.X509Certificates.X509ContentType" /> values, and using the specified password.</summary>
/// <returns>An array of bytes that represents the current <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> object.</returns>
/// <param name="contentType">One of the <see cref="T:System.Security.Cryptography.X509Certificates.X509ContentType" /> values that describes how to format the output data.</param>
/// <param name="password">The password required to access the X.509 certificate data.</param>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">A value other than <see cref="F:System.Security.Cryptography.X509Certificates.X509ContentType.Cert" />, <see cref="F:System.Security.Cryptography.X509Certificates.X509ContentType.SerializedCert" />, or <see cref="F:System.Security.Cryptography.X509Certificates.X509ContentType.Pkcs12" /> was passed to the <paramref name="contentType" /> parameter.-or-The certificate could not be exported.</exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.KeyContainerPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Open, Export" />
/// </PermissionSet>
// Token: 0x06002E71 RID: 11889 RVA: 0x00094DD0 File Offset: 0x00092FD0
[ComVisible(false)]
[MonoTODO("X509ContentType.Pfx/Pkcs12 and SerializedCert are not supported")]
public virtual byte[] Export(X509ContentType contentType, string password)
{
byte[] array = ((password != null) ? Encoding.UTF8.GetBytes(password) : null);
return this.Export(contentType, array);
}
/// <summary>Exports the current <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> object to a byte array using the specified format and a password.</summary>
/// <returns>A byte array that represents the current <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> object.</returns>
/// <param name="contentType">One of the <see cref="T:System.Security.Cryptography.X509Certificates.X509ContentType" /> values that describes how to format the output data.</param>
/// <param name="password">The password required to access the X.509 certificate data.</param>
/// <exception cref="T:System.Security.Cryptography.CryptographicException">A value other than <see cref="F:System.Security.Cryptography.X509Certificates.X509ContentType.Cert" />, <see cref="F:System.Security.Cryptography.X509Certificates.X509ContentType.SerializedCert" />, or <see cref="F:System.Security.Cryptography.X509Certificates.X509ContentType.Pkcs12" /> was passed to the <paramref name="contentType" /> parameter.-or-The certificate could not be exported.</exception>
// Token: 0x06002E72 RID: 11890 RVA: 0x00094E00 File Offset: 0x00093000
[MonoTODO("X509ContentType.Pfx/Pkcs12 and SerializedCert are not supported. SecureString support is incomplete.")]
public virtual byte[] Export(X509ContentType contentType, SecureString password)
{
byte[] array = ((password != null) ? password.GetBuffer() : null);
return this.Export(contentType, array);
}
// Token: 0x06002E73 RID: 11891 RVA: 0x00094E28 File Offset: 0x00093028
internal byte[] Export(X509ContentType contentType, byte[] password)
{
if (this.x509 == null)
{
throw new CryptographicException(Locale.GetText("Certificate instance is empty."));
}
byte[] rawData;
try
{
switch (contentType)
{
case X509ContentType.Cert:
rawData = this.x509.RawData;
break;
case X509ContentType.SerializedCert:
throw new NotSupportedException();
case X509ContentType.Pfx:
throw new NotSupportedException();
default:
{
string text = Locale.GetText("This certificate format '{0}' cannot be exported.", new object[] { contentType });
throw new CryptographicException(text);
}
}
}
finally
{
if (password != null)
{
Array.Clear(password, 0, password.Length);
}
}
return rawData;
}
/// <summary>Populates the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> object with data from a byte array.</summary>
/// <param name="rawData">A byte array containing data from an X.509 certificate. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="rawData" /> parameter is null.-or-The length of the <paramref name="rawData" /> parameter is 0.</exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.KeyContainerPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Create" />
/// </PermissionSet>
// Token: 0x06002E74 RID: 11892 RVA: 0x00094EDC File Offset: 0x000930DC
[ComVisible(false)]
public virtual void Import(byte[] rawData)
{
this.Import(rawData, null, X509KeyStorageFlags.DefaultKeySet);
}
/// <summary>Populates the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> object using data from a byte array, a password, and flags for determining how the private key is imported.</summary>
/// <param name="rawData">A byte array containing data from an X.509 certificate. </param>
/// <param name="password">The password required to access the X.509 certificate data. </param>
/// <param name="keyStorageFlags">One of the <see cref="T:System.Security.Cryptography.X509Certificates.X509KeyStorageFlags" /> values that controls where and how the private key is imported. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="rawData" /> parameter is null.-or-The length of the <paramref name="rawData" /> parameter is 0.</exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.KeyContainerPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Create" />
/// </PermissionSet>
// Token: 0x06002E75 RID: 11893 RVA: 0x00094EE8 File Offset: 0x000930E8
[MonoTODO("missing KeyStorageFlags support")]
[ComVisible(false)]
public virtual void Import(byte[] rawData, string password, X509KeyStorageFlags keyStorageFlags)
{
this.Reset();
if (password == null)
{
try
{
this.x509 = new X509Certificate(rawData);
}
catch (Exception ex)
{
try
{
PKCS12 pkcs = new PKCS12(rawData);
if (pkcs.Certificates.Count > 0)
{
this.x509 = pkcs.Certificates[0];
}
else
{
this.x509 = null;
}
}
catch
{
string text = Locale.GetText("Unable to decode certificate.");
throw new CryptographicException(text, ex);
}
}
}
else
{
try
{
PKCS12 pkcs2 = new PKCS12(rawData, password);
if (pkcs2.Certificates.Count > 0)
{
this.x509 = pkcs2.Certificates[0];
}
else
{
this.x509 = null;
}
}
catch
{
this.x509 = new X509Certificate(rawData);
}
}
}
/// <summary>Populates an <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> object using data from a byte array, a password, and a key storage flag.</summary>
/// <param name="rawData">A byte array that contains data from an X.509 certificate. </param>
/// <param name="password">The password required to access the X.509 certificate data. </param>
/// <param name="keyStorageFlags">One of the <see cref="T:System.Security.Cryptography.X509Certificates.X509KeyStorageFlags" /> values that controls where and how to import the private key. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="rawData" /> parameter is null.-or-The length of the <paramref name="rawData" /> parameter is 0.</exception>
// Token: 0x06002E76 RID: 11894 RVA: 0x0009500C File Offset: 0x0009320C
[MonoTODO("SecureString support is incomplete")]
public virtual void Import(byte[] rawData, SecureString password, X509KeyStorageFlags keyStorageFlags)
{
this.Import(rawData, null, keyStorageFlags);
}
/// <summary>Populates the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> object with information from a certificate file.</summary>
/// <param name="fileName">The name of a certificate file represented as a string. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="fileName" /> parameter is null.</exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.KeyContainerPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Create" />
/// </PermissionSet>
// Token: 0x06002E77 RID: 11895 RVA: 0x00095018 File Offset: 0x00093218
[ComVisible(false)]
public virtual void Import(string fileName)
{
byte[] array = X509Certificate.Load(fileName);
this.Import(array, null, X509KeyStorageFlags.DefaultKeySet);
}
/// <summary>Populates the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> object with information from a certificate file, a password, and a <see cref="T:System.Security.Cryptography.X509Certificates.X509KeyStorageFlags" /> value.</summary>
/// <param name="fileName">The name of a certificate file represented as a string. </param>
/// <param name="password">The password required to access the X.509 certificate data. </param>
/// <param name="keyStorageFlags">One of the <see cref="T:System.Security.Cryptography.X509Certificates.X509KeyStorageFlags" /> values that controls where and how the private key is imported. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="fileName" /> parameter is null.</exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.KeyContainerPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Create" />
/// </PermissionSet>
// Token: 0x06002E78 RID: 11896 RVA: 0x00095038 File Offset: 0x00093238
[ComVisible(false)]
[MonoTODO("missing KeyStorageFlags support")]
public virtual void Import(string fileName, string password, X509KeyStorageFlags keyStorageFlags)
{
byte[] array = X509Certificate.Load(fileName);
this.Import(array, password, keyStorageFlags);
}
/// <summary>Populates an <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate" /> object with information from a certificate file, a password, and a key storage flag.</summary>
/// <param name="fileName">The name of a certificate file. </param>
/// <param name="password">The password required to access the X.509 certificate data. </param>
/// <param name="keyStorageFlags">One of the <see cref="T:System.Security.Cryptography.X509Certificates.X509KeyStorageFlags" /> values that controls where and how to import the private key. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="fileName" /> parameter is null.</exception>
// Token: 0x06002E79 RID: 11897 RVA: 0x00095058 File Offset: 0x00093258
[MonoTODO("SecureString support is incomplete, missing KeyStorageFlags support")]
public virtual void Import(string fileName, SecureString password, X509KeyStorageFlags keyStorageFlags)
{
byte[] array = X509Certificate.Load(fileName);
this.Import(array, null, keyStorageFlags);
}
/// <summary>Resets the state of the <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> object.</summary>
// Token: 0x06002E7A RID: 11898 RVA: 0x00095078 File Offset: 0x00093278
[ComVisible(false)]
public virtual void Reset()
{
this.x509 = null;
this.issuer_name = null;
this.subject_name = null;
this.hideDates = false;
this.cachedCertificateHash = null;
}
// Token: 0x0400124D RID: 4685
private X509Certificate x509;
// Token: 0x0400124E RID: 4686
private bool hideDates;
// Token: 0x0400124F RID: 4687
private byte[] cachedCertificateHash;
// Token: 0x04001250 RID: 4688
private string issuer_name;
// Token: 0x04001251 RID: 4689
private string subject_name;
// Token: 0x020004E2 RID: 1250
internal struct CertificateContext
{
// Token: 0x04001252 RID: 4690
public uint dwCertEncodingType;
// Token: 0x04001253 RID: 4691
public IntPtr pbCertEncoded;
// Token: 0x04001254 RID: 4692
public uint cbCertEncoded;
// Token: 0x04001255 RID: 4693
public IntPtr pCertInfo;
// Token: 0x04001256 RID: 4694
public IntPtr hCertStore;
}
}
}
@@ -0,0 +1,36 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Cryptography.X509Certificates
{
/// <summary>Specifies the format of an X.509 certificate. </summary>
// Token: 0x020004E3 RID: 1251
[ComVisible(true)]
public enum X509ContentType
{
/// <summary>An unknown X.509 certificate. </summary>
// Token: 0x04001258 RID: 4696
Unknown,
/// <summary>A single X.509 certificate.</summary>
// Token: 0x04001259 RID: 4697
Cert,
/// <summary>A single serialized X.509 certificate. </summary>
// Token: 0x0400125A RID: 4698
SerializedCert,
/// <summary>A PFX-formatted certificate. The Pfx value is identical to the Pkcs12 value.</summary>
// Token: 0x0400125B RID: 4699
Pfx,
/// <summary>A serialized store.</summary>
// Token: 0x0400125C RID: 4700
SerializedStore,
/// <summary>A PKCS #7formatted certificate.</summary>
// Token: 0x0400125D RID: 4701
Pkcs7,
/// <summary>An Authenticode X.509 certificate. </summary>
// Token: 0x0400125E RID: 4702
Authenticode,
/// <summary>A PKCS #12formatted certificate. The Pkcs12 value is identical to the Pfx value.</summary>
// Token: 0x0400125F RID: 4703
Pkcs12 = 3
}
}
@@ -0,0 +1,32 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Cryptography.X509Certificates
{
/// <summary>Defines where and how to export the private key of an X.509 certificate.</summary>
// Token: 0x020004E4 RID: 1252
[Flags]
[ComVisible(true)]
[Serializable]
public enum X509KeyStorageFlags
{
/// <summary>The default key set is used. The user key set is usually the default. </summary>
// Token: 0x04001261 RID: 4705
DefaultKeySet = 0,
/// <summary>Private keys are stored in the current user store rather than the local computer store. This occurs even if the certificate specifies that the keys should go in the local computer store. </summary>
// Token: 0x04001262 RID: 4706
UserKeySet = 1,
/// <summary>Private keys are stored in the local computer store rather than the current user store. </summary>
// Token: 0x04001263 RID: 4707
MachineKeySet = 2,
/// <summary>Imported keys are marked as exportable. .</summary>
// Token: 0x04001264 RID: 4708
Exportable = 4,
/// <summary>Notify the user through a dialog box or other method that the key is accessed. The Cryptographic Service Provider (CSP) in use defines the precise behavior.</summary>
// Token: 0x04001265 RID: 4709
UserProtected = 8,
/// <summary>The key associated with a PFX file is persisted when importing a certificate.</summary>
// Token: 0x04001266 RID: 4710
PersistKeySet = 16
}
}