Partilhar via


X509Chain Construtores

Definição

Inicializa uma nova instância da classe X509Chain.

Sobrecargas

X509Chain()

Inicializa uma nova instância da classe X509Chain.

X509Chain(Boolean)

Inicializa uma nova instância da classe X509Chain especificando um valor que indica se o contexto do computador deve ser usado.

X509Chain(IntPtr)

Inicializa uma nova instância da classe X509Chain usando um identificador IntPtr para uma cadeia X.509.

X509Chain()

Origem:
X509Chain.cs
Origem:
X509Chain.cs
Origem:
X509Chain.cs

Inicializa uma nova instância da classe X509Chain.

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

Exemplos

O exemplo de código a seguir abre o repositório de certificados pessoal do usuário atual, permite que você selecione um certificado e, em seguida, grava informações de cadeia de certificados e certificados no console. A saída depende do certificado selecionado.

//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)

Aplica-se a

X509Chain(Boolean)

Origem:
X509Chain.cs
Origem:
X509Chain.cs
Origem:
X509Chain.cs

Inicializa uma nova instância da classe X509Chain especificando um valor que indica se o contexto do computador deve ser usado.

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

true para usar o contexto do computador, false para usar o contexto do usuário atual.

Atributos

Exemplos

O exemplo de código a seguir abre o repositório de certificados pessoal do usuário atual, permite que você selecione um certificado e, em seguida, grava informações de cadeia de certificados e certificados no console. A saída depende do certificado selecionado.

//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)

Comentários

Esse construtor pode ser usado quando o perfil do usuário não é carregado e o contexto do computador precisa ser usado. Quando o useMachineContext parâmetro é definido como true, o contexto do computador local (HCCE_LOCAL_MACHINE sinalizador) é usado para criar a cadeia. Se o parâmetro for definido como false, o contexto do usuário atual (HCCE_CURRENT_USER sinalizador) será usado.

Aplica-se a

X509Chain(IntPtr)

Origem:
X509Chain.cs
Origem:
X509Chain.cs
Origem:
X509Chain.cs

Inicializa uma nova instância da classe X509Chain usando um identificador IntPtr para uma cadeia 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

Um identificador IntPtr para uma cadeia X.509.

Atributos

Exceções

O parâmetro chainContext é null.

O parâmetro chainContext aponta para um contexto inválido.

Comentários

Use esse construtor para fornecer compatibilidade com a CAPI (API Criptográfica) da Microsoft não gerenciada.

Aplica-se a