I'm using C#.NET and need to install a bunch of certificates into the Windows certificate store.
I need to check which of those certificates are root certificates (i.e. self-signed), so I can install them into the "Trusted root certificates" store.
I'm using the standard X509Certificate2
class. My current idea is to check whether the Issuer
and Subject
are the same.
I've noticed that X509Certificate2
has Issuer
- IssuerName
and Subject
- SubjectName
.
Is it better to compare Issuer
to Subject
, or IssuerName
to SubjectName
? Or doesn't it really matter?
Also, is this a reliable method or would I be better off using another approach?