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

Find a Certificate in the "Other People" Windows Certificate Store

See more Certificates Examples

Demonstrates how to open the "Current User --> Other People" Windows certificate store, and locates a certificate matching an email address.

Chilkat Go Downloads

Go
    success := false

    certStore := chilkat.NewCertStore()

    //  The "AddressBook" is the "Other People" certificate store as shown in certmgr.msc
    readOnly := true
    success = certStore.OpenWindowsStore("CurrentUser","AddressBook",readOnly)
    if success != true {
        fmt.Println(certStore.LastErrorText())
        certStore.DisposeCertStore()
        return
    }

    //  Find the certificate for the email address:
    jsonE := chilkat.NewJsonObject()
    jsonE.UpdateString("email","joe@example.com")

    cert := chilkat.NewCert()
    success = certStore.FindCert(jsonE,cert)
    if success == false {
        fmt.Println(certStore.LastErrorText())
        certStore.DisposeCertStore()
        jsonE.DisposeJsonObject()
        cert.DisposeCert()
        return
    }

    fmt.Println("Found certificate: ", cert.SubjectDN())

    certStore.DisposeCertStore()
    jsonE.DisposeJsonObject()
    cert.DisposeCert()