Bagikan melalui


X509Chain Konstruktor

Definisi

Menginisialisasi instans baru kelas X509Chain.

Overload

X509Chain()

Menginisialisasi instans baru kelas X509Chain.

X509Chain(Boolean)

Menginisialisasi instans X509Chain baru kelas yang menentukan nilai yang menunjukkan apakah konteks komputer harus digunakan.

X509Chain(IntPtr)

Menginisialisasi instans X509Chain baru kelas menggunakan IntPtr handel ke rantai X.509.

X509Chain()

Sumber:
X509Chain.cs
Sumber:
X509Chain.cs
Sumber:
X509Chain.cs

Menginisialisasi instans baru kelas X509Chain.

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

Contoh

Contoh kode berikut membuka penyimpanan sertifikat pribadi pengguna saat ini, memungkinkan Anda memilih sertifikat, lalu menulis sertifikat dan informasi rantai sertifikat ke konsol. Output tergantung pada sertifikat yang Anda pilih.

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

Berlaku untuk

X509Chain(Boolean)

Sumber:
X509Chain.cs
Sumber:
X509Chain.cs
Sumber:
X509Chain.cs

Menginisialisasi instans X509Chain baru kelas yang menentukan nilai yang menunjukkan apakah konteks komputer harus digunakan.

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)

Parameter

useMachineContext
Boolean

true untuk menggunakan konteks mesin; false untuk menggunakan konteks pengguna saat ini.

Atribut

Contoh

Contoh kode berikut membuka penyimpanan sertifikat pribadi pengguna saat ini, memungkinkan Anda memilih sertifikat, lalu menulis sertifikat dan informasi rantai sertifikat ke konsol. Output tergantung pada sertifikat yang Anda pilih.

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

Keterangan

Konstruktor ini dapat digunakan ketika profil pengguna tidak dimuat dan konteks komputer perlu digunakan. useMachineContext Ketika parameter diatur ke true, konteks komputer lokal (bendera HCCE_LOCAL_MACHINE) digunakan untuk membuat rantai. Jika parameter diatur ke false, konteks pengguna saat ini (bendera HCCE_CURRENT_USER) digunakan.

Berlaku untuk

X509Chain(IntPtr)

Sumber:
X509Chain.cs
Sumber:
X509Chain.cs
Sumber:
X509Chain.cs

Menginisialisasi instans X509Chain baru kelas menggunakan IntPtr handel ke rantai 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)

Parameter

chainContext
IntPtr

nativeint

Handel IntPtr ke rantai X.509.

Atribut

Pengecualian

Parameternya chainContext adalah null.

Parameter chainContext menunjuk ke konteks yang tidak valid.

Keterangan

Gunakan konstruktor ini untuk memberikan kompatibilitas dengan Microsoft Cryptographic API (CAPI) yang tidak dikelola.

Berlaku untuk