X509Certificate.GetEffectiveDateString Метод

Определение

Возвращает дату действия этого сертификата X.509v3.

public:
 virtual System::String ^ GetEffectiveDateString();
public virtual string GetEffectiveDateString();
abstract member GetEffectiveDateString : unit -> string
override this.GetEffectiveDateString : unit -> string
Public Overridable Function GetEffectiveDateString () As String

Возвращаемое значение

Дата действия этого сертификата X.509.

Примеры

В следующем примере метод используется GetEffectiveDateString для получения даты действия сертификата и отображения его в консоли.


using System;
using System.Security.Cryptography.X509Certificates;

public class X509
{

    public static void Main()
    {

        // The path to the certificate.
        string Certificate =  "Certificate.cer";

        // Load the certificate into an X509Certificate object.
        X509Certificate cert = X509Certificate.CreateFromCertFile(Certificate);

        // Get the value.
        string results = cert.GetEffectiveDateString();

        // Display the value to the console.
        Console.WriteLine(results);
    }
}
Imports System.Security.Cryptography.X509Certificates




Public Class X509
   
   
   Public Shared Sub Main()
      
      ' The path to the certificate.
      Dim Certificate As String = "Certificate.cer"
      
      ' Load the certificate into an X509Certificate object.
      Dim cert As X509Certificate = X509Certificate.CreateFromCertFile(Certificate)
      
      ' Get the value.
      Dim results As String = cert.GetEffectiveDateString()
      
      ' Display the value to the console.
      Console.WriteLine(results)
   End Sub
End Class

Комментарии

Срок действия — это дата, после которой сертификат X.509 считается допустимым.

Метод GetEffectiveDateString возвращает строку, отображающую дату, отформатированную в шаблоне коротких дат, за которым следует время в формате Long Time Pattern. Дата и время форматируются с помощью текущего языка и часового пояса.

Применяется к