question

osvbnet avatar image
0 Votes"
osvbnet asked osvbnet edited

Read all system certificates

Hello,
I need to read and show ALL the certificates in the system
Unfortunately, X509Store.Certificates does not have a method like GetAllCertificates
Any better way than Find, or how to pass a MARK ALL like * to Find?
Where's Certificate.IssuedTo and Certificate.EmailAddress? How to get them?
Thanks for the help :)

dotnet-visual-basic
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

cooldadtx avatar image
0 Votes"
cooldadtx answered osvbnet edited

I'm a little confused because you said you want all certs but then you're trying to ask questions about finding certs. Note that there are a lot of certs on machines so enumerating them all is going to be slow.

Certs are contained per store so to get all the certs you'd have to open all the stores one by one. For each store you can then use the Certificates property to enumerate the certs in that store.

Dim store As New X509Store(StoreName.Root, StoreLocation.LocalMachine)
store.Open(OpenFlags.ReadOnly)

For Each cert In store.Certificates
    Console.WriteLine($"Subject: {cert.Subject} Issuer: {cert.Issuer}")
Next
store.Close()


As for getting the email I don't know what you're referring to. There is no email associated with a cert. You can get the properties associated with a cert that may have some metadata that has an email but that would depend on the cert.

The issued to and issuer are always the same from what I've seen.

· 6
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks, got it, just one thing:

IssuedBy and IssuedTo is mostly different!
For example. when I get a certificate, The Comodo is Issuer (IssuedBy) and I'm (IssuedTo)

So Certificate.IssuedTo is still a mystery :(

0 Votes 0 ·

Can you provide a screenshot of what you're seeing please?

0 Votes 0 ·

Thanks dude, It's very obvious, imagine you get a code signing certificate to sign your exe/dll files
IssuedBy or Issuer is a certificate authority like Thawte or Comodo
IssuedTo is you!

0 Votes 0 ·
Show more comments