Sample code for 30+ languages & platforms
Xbase++

Windows Certificate Stores - Find Certificate by Common Name

See more Certificates Examples

Searches the Windows certificate stores for a certificate that matches the specified common name (CN).

Note: This example requires Chilkat v10.0.0 or greater.

Chilkat Xbase++ Downloads

Xbase++
LOCAL nSuccess
LOCAL oCert

nSuccess := 0

oCert := CreateObject("Chilkat.Cert")
nSuccess := oCert:LoadByCommonName("Chilkat Software, Inc.")
IF (nSuccess == 0)
    ? oCert:LastErrorText
    oCert:destroy()
    RETURN
ENDIF

? oCert:SubjectDN
? "Success."

oCert:destroy()