共用方式為


X509ChainPolicy.VerificationTime 屬性

定義

取得或設定要驗證鏈結的時間。

public:
 property DateTime VerificationTime { DateTime get(); void set(DateTime value); };
public DateTime VerificationTime { get; set; }
member this.VerificationTime : DateTime with get, set
Public Property VerificationTime As DateTime

屬性值

DateTime 物件。

範例

下列範例會開啟目前使用者的個人憑證存儲,允許使用者選取憑證,然後將憑證和憑證鏈結資訊寫入主控台。 輸出取決於您選取的憑證。

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

備註

這個屬性代表鏈結驗證的時間參數。 這個屬性會傳回值,指出要驗證鏈結的時間,視屬性的值 DateTime.Kind 而定,為當地時間或 UTC。 驗證已簽署的訊息時,這個屬性很重要,因為簽章在簽署時必須有效,而不是在驗證時有效。 鏈結中的每個憑證必須 X509Certificate2.NotBefore 晚于這個屬性的值,而且 X509Certificate2.NotAfter 時間不得早于這個屬性的值。 否則,會 X509ChainStatusFlags.NotTimeValid 判斷提示旗標。 在 Windows 上,此屬性也可用來判斷憑證的撤銷狀態。

類別的 X509ChainPolicy 無參數建構函式會將 VerificationTime 屬性設定為呼叫建構函式的時間。 呼叫 方法會將 Reset() 的值 VerificationTime 取代為目前的系統時間,而不是使用物件建構的時間。

適用於