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)

注解

此属性表示链验证的时间参数。 此属性返回一个值,该值指示要验证链的时间(本地时间或 UTC),具体取决于 属性的值 DateTime.Kind 。 此属性在验证已签名消息时非常重要,因为签名必须在签名时有效,而不是在验证时有效。 链中的每个证书的时间必须 X509Certificate2.NotBefore 不晚于此属性的值,并且 X509Certificate2.NotAfter 时间不得早于此属性的值。 否则,将 X509ChainStatusFlags.NotTimeValid 断言标志。 在 Windows 上,此属性还可用于确定证书的吊销状态。

类的 X509ChainPolicy 无参数构造函数将 VerificationTime 属性设置为调用构造函数的时间。 Reset()调用 方法会将 的值VerificationTime替换为当前系统时间,而不是将 替换为构造对象的时间。

适用于