Sample code for 30+ languages & platforms
VB.NET

List Certificates in the Current User Certificate Store (Windows Only)

See more Certificates Examples

This is a Windows-only example to list the certificates in the current-user certificate store (located in the Windows Registry).

Chilkat VB.NET Downloads

VB.NET
Dim success As Boolean = False

' This is a Windows-only example because it lists the certificates
' stored in the Windows Current User Certificate Store located in the
' Windows Registry.

Dim certStore As New Chilkat.CertStore

Dim readOnly As Boolean = True
success = certStore.OpenCurrentUserStore(readOnly)
If (success = False) Then
    Debug.WriteLine(certStore.LastErrorText)
    Exit Sub
End If


Dim cert As New Chilkat.Cert
Dim numCerts As Integer = certStore.NumCertificates
Dim i As Integer = 0
While i < numCerts
    certStore.GetCert(i,cert)
    Debug.WriteLine("DN = " & cert.SubjectDN)
    Debug.WriteLine("Email = " & cert.SubjectE)
    i = i + 1
End While