Sample code for 30+ languages & platforms
Go Requires Chilkat v10.1.2+

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 Go Downloads

Go
    success := 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.

    certStore := chilkat.NewCertStore()

    readOnly := true
    success = certStore.OpenCurrentUserStore(readOnly)
    if success == false {
        fmt.Println(certStore.LastErrorText())
        certStore.DisposeCertStore()
        return
    }

    cert := chilkat.NewCert()
    numCerts := certStore.NumCertificates()
    i := 0
    for i < numCerts {
        certStore.GetCert(i,cert)
        fmt.Println("DN = ", cert.SubjectDN())
        fmt.Println("Email = ", cert.SubjectE())
        i = i + 1
    }


    certStore.DisposeCertStore()
    cert.DisposeCert()