X509Certificate2.Issuer Property

On this page

Overview

Gets the issuer name of the X.509 certificate.

The Issuer property returns a string representing the distinguished name of the certificate issuer. This information is crucial for verifying the authenticity and trustworthiness of the certificate.

Property Value

string The distinguished name of the certificate issuer.

Remarks

The issuer name is a sequence of relative distinguished names (RDNs), such as "CN=My Certificate Authority, O=My Organization, C=US". This property provides the issuer's name in a string format, making it easy to display or compare.

If the certificate does not contain issuer information, an empty string is returned.

The format of the returned string is typically the X.500 distinguished name format.

Example


// C# Example
using System;
using System.Security.Cryptography.X509Certificates;

public class CertificateIssuerExample
{
    public static void Main(string[] args)
    {
        try
        {
            // Load a certificate (replace with actual certificate loading logic)
            using (X509Certificate2 cert = new X509Certificate2(@"C:\path\to\your\certificate.cer"))
            {
                string issuerName = cert.Issuer;
                Console.WriteLine($"Certificate Issuer: {issuerName}");

                // You can also access individual components of the issuer name
                foreach (X509RdnAttribute attribute in cert.IssuerName.Name)
                {
                    Console.WriteLine($"  {attribute.FriendlyName}: {attribute.Value}");
                }
            }
        }
        catch (Exception ex)
        {
            Console.WriteLine($"An error occurred: {ex.Message}");
        }
    }
}
                

Requirements

Assembly File
mscorlib.dll System.dll

.NET Framework Class Library

Supported in Note
.NET Framework 1.0, 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.6, 4.7, 4.8
.NET Core 1.0, 1.1, 2.0, 2.1, 2.2, 3.0, 3.1
.NET 5+, .NET Standard 1.3+

See Also