Compartir vía


X509Chain Constructores

Definición

Inicializa una nueva instancia de la clase X509Chain.

Sobrecargas

X509Chain()

Inicializa una nueva instancia de la clase X509Chain.

X509Chain(Boolean)

Inicializa una nueva instancia de la clase X509Chain especificando un valor que indica si se debe usar el contexto de la máquina.

X509Chain(IntPtr)

Inicializa una nueva instancia de la clase X509Chain mediante un identificador IntPtr de una cadena X.509.

X509Chain()

Source:
X509Chain.cs
Source:
X509Chain.cs
Source:
X509Chain.cs

Inicializa una nueva instancia de la clase X509Chain.

public:
 X509Chain();
public X509Chain ();
[System.Security.SecurityCritical]
public X509Chain ();
Public Sub New ()
Atributos

Ejemplos

En el ejemplo de código siguiente se abre el almacén de certificados personal del usuario actual, se puede seleccionar un certificado y, a continuación, se escribe información sobre el certificado y la cadena de certificados en la consola. La salida depende del certificado que seleccione.

//Output chain information of the selected certificate.
X509Chain ^ ch = gcnew X509Chain;
ch->ChainPolicy->RevocationMode = X509RevocationMode::Online;
ch->Build( certificate );
Console::WriteLine( "Chain Information" );
Console::WriteLine( "Chain revocation flag: {0}", ch->ChainPolicy->RevocationFlag );
Console::WriteLine( "Chain revocation mode: {0}", ch->ChainPolicy->RevocationMode );
Console::WriteLine( "Chain verification flag: {0}", ch->ChainPolicy->VerificationFlags );
Console::WriteLine( "Chain verification time: {0}", ch->ChainPolicy->VerificationTime );
Console::WriteLine( "Chain status length: {0}", ch->ChainStatus->Length );
Console::WriteLine( "Chain application policy count: {0}", ch->ChainPolicy->ApplicationPolicy->Count );
Console::WriteLine( "Chain certificate policy count: {0} {1}", ch->ChainPolicy->CertificatePolicy->Count, Environment::NewLine );
//Output chain information of the selected certificate.
X509Chain ch = new X509Chain();
ch.ChainPolicy.RevocationMode = X509RevocationMode.Online;
ch.Build (certificate);
Console.WriteLine ("Chain Information");
Console.WriteLine ("Chain revocation flag: {0}", ch.ChainPolicy.RevocationFlag);
Console.WriteLine ("Chain revocation mode: {0}", ch.ChainPolicy.RevocationMode);
Console.WriteLine ("Chain verification flag: {0}", ch.ChainPolicy.VerificationFlags);
Console.WriteLine ("Chain verification time: {0}", ch.ChainPolicy.VerificationTime);
Console.WriteLine ("Chain status length: {0}", ch.ChainStatus.Length);
Console.WriteLine ("Chain application policy count: {0}", ch.ChainPolicy.ApplicationPolicy.Count);
Console.WriteLine ("Chain certificate policy count: {0} {1}", ch.ChainPolicy.CertificatePolicy.Count, Environment.NewLine);
'Output chain information of the selected certificate.
Dim ch As New X509Chain()
ch.ChainPolicy.RevocationMode = X509RevocationMode.Online
ch.Build(certificate)
Console.WriteLine("Chain Information")
Console.WriteLine("Chain revocation flag: {0}", ch.ChainPolicy.RevocationFlag)
Console.WriteLine("Chain revocation mode: {0}", ch.ChainPolicy.RevocationMode)
Console.WriteLine("Chain verification flag: {0}", ch.ChainPolicy.VerificationFlags)
Console.WriteLine("Chain verification time: {0}", ch.ChainPolicy.VerificationTime)
Console.WriteLine("Chain status length: {0}", ch.ChainStatus.Length)
Console.WriteLine("Chain application policy count: {0}", ch.ChainPolicy.ApplicationPolicy.Count)
Console.WriteLine("Chain certificate policy count: {0} {1}", ch.ChainPolicy.CertificatePolicy.Count, Environment.NewLine)

Se aplica a

X509Chain(Boolean)

Source:
X509Chain.cs
Source:
X509Chain.cs
Source:
X509Chain.cs

Inicializa una nueva instancia de la clase X509Chain especificando un valor que indica si se debe usar el contexto de la máquina.

public:
 X509Chain(bool useMachineContext);
public X509Chain (bool useMachineContext);
[System.Security.SecurityCritical]
public X509Chain (bool useMachineContext);
new System.Security.Cryptography.X509Certificates.X509Chain : bool -> System.Security.Cryptography.X509Certificates.X509Chain
[<System.Security.SecurityCritical>]
new System.Security.Cryptography.X509Certificates.X509Chain : bool -> System.Security.Cryptography.X509Certificates.X509Chain
Public Sub New (useMachineContext As Boolean)

Parámetros

useMachineContext
Boolean

Es true para utilizar el contexto del equipo; es false para utilizar el contexto del usuario actual.

Atributos

Ejemplos

En el ejemplo de código siguiente se abre el almacén de certificados personal del usuario actual, se puede seleccionar un certificado y, a continuación, se escribe información sobre el certificado y la cadena de certificados en la consola. La salida depende del certificado que seleccione.

//Output chain information of the selected certificate.
X509Chain ^ ch = gcnew X509Chain;
ch->ChainPolicy->RevocationMode = X509RevocationMode::Online;
ch->Build( certificate );
Console::WriteLine( "Chain Information" );
Console::WriteLine( "Chain revocation flag: {0}", ch->ChainPolicy->RevocationFlag );
Console::WriteLine( "Chain revocation mode: {0}", ch->ChainPolicy->RevocationMode );
Console::WriteLine( "Chain verification flag: {0}", ch->ChainPolicy->VerificationFlags );
Console::WriteLine( "Chain verification time: {0}", ch->ChainPolicy->VerificationTime );
Console::WriteLine( "Chain status length: {0}", ch->ChainStatus->Length );
Console::WriteLine( "Chain application policy count: {0}", ch->ChainPolicy->ApplicationPolicy->Count );
Console::WriteLine( "Chain certificate policy count: {0} {1}", ch->ChainPolicy->CertificatePolicy->Count, Environment::NewLine );
//Output chain information of the selected certificate.
X509Chain ch = new X509Chain();
ch.ChainPolicy.RevocationMode = X509RevocationMode.Online;
ch.Build (certificate);
Console.WriteLine ("Chain Information");
Console.WriteLine ("Chain revocation flag: {0}", ch.ChainPolicy.RevocationFlag);
Console.WriteLine ("Chain revocation mode: {0}", ch.ChainPolicy.RevocationMode);
Console.WriteLine ("Chain verification flag: {0}", ch.ChainPolicy.VerificationFlags);
Console.WriteLine ("Chain verification time: {0}", ch.ChainPolicy.VerificationTime);
Console.WriteLine ("Chain status length: {0}", ch.ChainStatus.Length);
Console.WriteLine ("Chain application policy count: {0}", ch.ChainPolicy.ApplicationPolicy.Count);
Console.WriteLine ("Chain certificate policy count: {0} {1}", ch.ChainPolicy.CertificatePolicy.Count, Environment.NewLine);
'Output chain information of the selected certificate.
Dim ch As New X509Chain()
ch.ChainPolicy.RevocationMode = X509RevocationMode.Online
ch.Build(certificate)
Console.WriteLine("Chain Information")
Console.WriteLine("Chain revocation flag: {0}", ch.ChainPolicy.RevocationFlag)
Console.WriteLine("Chain revocation mode: {0}", ch.ChainPolicy.RevocationMode)
Console.WriteLine("Chain verification flag: {0}", ch.ChainPolicy.VerificationFlags)
Console.WriteLine("Chain verification time: {0}", ch.ChainPolicy.VerificationTime)
Console.WriteLine("Chain status length: {0}", ch.ChainStatus.Length)
Console.WriteLine("Chain application policy count: {0}", ch.ChainPolicy.ApplicationPolicy.Count)
Console.WriteLine("Chain certificate policy count: {0} {1}", ch.ChainPolicy.CertificatePolicy.Count, Environment.NewLine)

Comentarios

Este constructor se puede usar cuando no se carga el perfil de usuario y se debe usar el contexto de la máquina. Cuando el useMachineContext parámetro se establece trueen , el contexto del equipo local (HCCE_LOCAL_MACHINE marca) se usa para crear la cadena. Si el parámetro se establece falseen , se usa el contexto de usuario actual (HCCE_CURRENT_USER marca).

Se aplica a

X509Chain(IntPtr)

Source:
X509Chain.cs
Source:
X509Chain.cs
Source:
X509Chain.cs

Inicializa una nueva instancia de la clase X509Chain mediante un identificador IntPtr de una cadena X.509.

public:
 X509Chain(IntPtr chainContext);
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public X509Chain (IntPtr chainContext);
public X509Chain (IntPtr chainContext);
[<System.Runtime.Versioning.SupportedOSPlatform("windows")>]
new System.Security.Cryptography.X509Certificates.X509Chain : nativeint -> System.Security.Cryptography.X509Certificates.X509Chain
new System.Security.Cryptography.X509Certificates.X509Chain : nativeint -> System.Security.Cryptography.X509Certificates.X509Chain
Public Sub New (chainContext As IntPtr)

Parámetros

chainContext
IntPtr

nativeint

Identificador IntPtr de una cadena X.509.

Atributos

Excepciones

El parámetro chainContext es null.

El parámetro chainContext apunta a un contexto no válido.

Comentarios

Use este constructor para proporcionar compatibilidad con la API criptográfica de Microsoft (CAPI) no administrada.

Se aplica a