Sample code for 30+ languages & platforms
Visual FoxPro

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 Visual FoxPro Downloads

Visual FoxPro
LOCAL lnSuccess
LOCAL loCertStore
LOCAL lnReadOnly
LOCAL loCert
LOCAL lnNumCerts
LOCAL i

lnSuccess = 0

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

loCertStore = CreateObject('Chilkat.CertStore')

lnReadOnly = 1
lnSuccess = loCertStore.OpenCurrentUserStore(lnReadOnly)
IF (lnSuccess = 0) THEN
    ? loCertStore.LastErrorText
    RELEASE loCertStore
    CANCEL
ENDIF

loCert = CreateObject('Chilkat.Cert')
lnNumCerts = loCertStore.NumCertificates
i = 0
DO WHILE i < lnNumCerts
    loCertStore.GetCert(i,loCert)
    ? "DN = " + loCert.SubjectDN
    ? "Email = " + loCert.SubjectE
    i = i + 1
ENDDO

RELEASE loCertStore
RELEASE loCert