X509Certificate.GetExpirationDateString 메서드

정의

이 X.509v3 인증서의 만료 날짜를 반환합니다.

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

반환

String

이 Authenticode X.509 v.3 인증서의 만료 날짜입니다.

예제

다음 예제에서는 메서드를 GetExpirationDateString 사용하여 인증서의 만료 날짜를 가져와서 콘솔에 표시합니다.

using namespace System;
using namespace System::Security::Cryptography::X509Certificates;
int 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->GetExpirationDateString();
   
   // Display the value to the console.
   Console::WriteLine( results );
}

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.GetExpirationDateString();

        // 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.GetExpirationDateString()
      
      ' Display the value to the console.
      Console.WriteLine(results)
   End Sub  
End Class

설명

만료 날짜는 X.509 인증서가 더 이상 유효한 것으로 간주되지 않는 날짜입니다.

이 메서드는 GetExpirationDateString 짧은 날짜 패턴으로 서식이 지정된 날짜와 장시간 패턴으로 서식이 지정된 시간을 보여 주는 문자열을 반환합니다. 날짜와 시간은 현재 문화권 및 표준 시간대를 사용하여 형식이 지정됩니다.

참고

이 메서드는 기본 개체가 동일한 값을 나타내지만 Macintosh 컴퓨터에서 다른 문자열 형식을 DateTime 반환할 수 있습니다.

적용 대상