Friday 20 May 2016

What is "Subject" in Digital Certificate?

Simple Image of digital certificate SUBJECT and its field.



Common format of subject:
CN=Mr Mac lal, Phone=3dfkgjfgdsfgsfkgdfskhgfy456054hdsfgsfgsdfgsdgs, S=Karnataka, PostalCode=560055, OU=Certifying authority, O=nCode, C=IN

Full form and details about subject fields in digital certificate
CN = Common Name
E = email@example.com
Phone = Hash of Telephone Number / Mobile Number
OU = Organization Unit
O = Organization
PostalCode = zip
S = State / Province
C = Country
SerialNumber = Hash of Pan


How to get certificate subject name in C#?
using System.Security.Cryptography.X509Certificates;
X509Certificate2 cert = new X509Certificate2( folder + "\\dgft.cer");
Console.WriteLine(cert.Subject);