Condividi tramite


X509Chain Costruttori

Definizione

Inizializza una nuova istanza della classe X509Chain.

Overload

X509Chain()

Inizializza una nuova istanza della classe X509Chain.

X509Chain(Boolean)

Inizializza una nuova istanza della classe X509Chain specificando un valore che indica se è necessario usare il contesto del computer.

X509Chain(IntPtr)

Inizializza una nuova istanza della classe X509Chain tramite un handle IntPtr per una catena X.509.

X509Chain()

Origine:
X509Chain.cs
Origine:
X509Chain.cs
Origine:
X509Chain.cs

Inizializza una nuova istanza della classe X509Chain.

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

Esempio

L'esempio di codice seguente apre l'archivio certificati personale dell'utente corrente, consente di selezionare un certificato, quindi scrive le informazioni sulla catena di certificati e certificato nella console. L'output dipende dal certificato selezionato.

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

Si applica a

X509Chain(Boolean)

Origine:
X509Chain.cs
Origine:
X509Chain.cs
Origine:
X509Chain.cs

Inizializza una nuova istanza della classe X509Chain specificando un valore che indica se è necessario usare il contesto del computer.

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)

Parametri

useMachineContext
Boolean

true per usare il contesto del computer, false per usare il contesto dell'utente corrente.

Attributi

Esempio

L'esempio di codice seguente apre l'archivio certificati personale dell'utente corrente, consente di selezionare un certificato, quindi scrive le informazioni sulla catena di certificati e certificato nella console. L'output dipende dal certificato selezionato.

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

Commenti

Questo costruttore può essere usato quando il profilo utente non viene caricato e il contesto del computer deve essere usato. Quando il parametro è impostato su true, viene usato il useMachineContext contesto del computer locale (HCCE_LOCAL_MACHINE flag) per creare la catena. Se il parametro è impostato su false, viene usato il contesto utente corrente (flag HCCE_CURRENT_USER).

Si applica a

X509Chain(IntPtr)

Origine:
X509Chain.cs
Origine:
X509Chain.cs
Origine:
X509Chain.cs

Inizializza una nuova istanza della classe X509Chain tramite un handle IntPtr per una catena 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)

Parametri

chainContext
IntPtr

nativeint

Handle IntPtr per una catena X.509.

Attributi

Eccezioni

Il valore del parametro chainContext è null.

Il parametro chainContext punta a un contesto non valido.

Commenti

Usare questo costruttore per fornire compatibilità con l'API Microsoft Cryptographic (CAPI) non gestita.

Si applica a