Provides extension methods for the X509Certificate2 class.
public static class X509Certificate2Extensions
string GetNameIdentifier(this X509Certificate2 certificate)Summary: Gets the name identifier of the certificate. This can be the FriendlyName, or a substring of the SubjectName.
Parameters:
certificate
- The X509Certificate2 object.Returns: The FriendlyName of the certificate if not null or empty; otherwise, a substring of the SubjectName starting from "CN=" if it exists, or the full SubjectName if "CN=" is not found.
bool IsValid(this X509Certificate2 certificate)Summary: Checks if the certificate is valid. A certificate is considered valid if it is not archived, the current date is within the certificate's validity period, and it has a non-empty name identifier.
Parameters:
certificate
- The X509Certificate2 object.Returns: True if the certificate is valid; otherwise, false.