X509Chain 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
初始化 X509Chain 類別的新執行個體。
多載
X509Chain() |
初始化 X509Chain 類別的新執行個體。 |
X509Chain(Boolean) |
初始化 X509Chain 類別的新執行個體,並指定一個值,表示是否應該使用電腦內容。 |
X509Chain(IntPtr) |
X509Chain()
- 來源:
- X509Chain.cs
- 來源:
- X509Chain.cs
- 來源:
- X509Chain.cs
初始化 X509Chain 類別的新執行個體。
public:
X509Chain();
public X509Chain ();
[System.Security.SecurityCritical]
public X509Chain ();
Public Sub New ()
- 屬性
範例
下列程式代碼範例會開啟目前使用者的個人證書存儲,可讓您選取憑證,然後將憑證和憑證鏈結資訊寫入控制台。 輸出取決於您選取的憑證。
//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)
適用於
X509Chain(Boolean)
- 來源:
- X509Chain.cs
- 來源:
- X509Chain.cs
- 來源:
- X509Chain.cs
初始化 X509Chain 類別的新執行個體,並指定一個值,表示是否應該使用電腦內容。
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)
參數
- useMachineContext
- Boolean
true
表示使用電腦內容,而 false
則表示使用目前的使用者內容。
- 屬性
範例
下列程式代碼範例會開啟目前使用者的個人證書存儲,可讓您選取憑證,然後將憑證和憑證鏈結資訊寫入控制台。 輸出取決於您選取的憑證。
//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)
備註
當使用者配置檔未載入且需要使用機器內容時,可以使用這個建構函式。
useMachineContext
當 參數設定為 true
時,會使用本機計算機內容 (HCCE_LOCAL_MACHINE 旗標) 來建立鏈結。 如果 參數設定為 false
,則會使用目前的用戶內容 (HCCE_CURRENT_USER 旗標) 。
適用於
X509Chain(IntPtr)
- 來源:
- X509Chain.cs
- 來源:
- X509Chain.cs
- 來源:
- X509Chain.cs
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)
參數
- 屬性
例外狀況
chainContext
參數為 null
。
chainContext
參數指向無效的內容。
備註
使用此建構函式提供與 Unmanaged Microsoft 密碼編譯 API (CAPI) 的相容性。