X509Certificate.GetExpirationDateString Metodo
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Restituisce la data di scadenza del certificato 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
Data di scadenza del certificato X.509.
Nell'esempio seguente viene usato il GetExpirationDateString metodo per ottenere la data di scadenza di un certificato e la visualizza nella console.
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
La data di scadenza è la data dopo la quale il certificato X.509 non è più considerato valido.
Il GetExpirationDateString metodo restituisce una stringa che mostra la data formattata in Short Date Pattern seguita dall'ora formattata in Long Time Pattern. La data e l'ora vengono formattate usando le impostazioni cultura e il fuso orario correnti.
Nota
Questo metodo può restituire un formato stringa diverso nei computer Macintosh, anche se l'oggetto sottostante DateTime rappresenta lo stesso valore.
Prodotto | Versioni |
---|---|
.NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
Feedback su .NET
.NET è un progetto open source. Seleziona un collegamento per fornire feedback: