Visual FoxPro
Visual FoxPro
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 Visual FoxPro Downloads
LOCAL lnSuccess
LOCAL loCertStore
LOCAL lnReadOnly
LOCAL loJsonE
LOCAL loCert
lnSuccess = 0
loCertStore = CreateObject('Chilkat.CertStore')
* The "AddressBook" is the "Other People" certificate store as shown in certmgr.msc
lnReadOnly = 1
lnSuccess = loCertStore.OpenWindowsStore("CurrentUser","AddressBook",lnReadOnly)
IF (lnSuccess <> 1) THEN
? loCertStore.LastErrorText
RELEASE loCertStore
CANCEL
ENDIF
* Find the certificate for the email address:
loJsonE = CreateObject('Chilkat.JsonObject')
loJsonE.UpdateString("email","joe@example.com")
loCert = CreateObject('Chilkat.Cert')
lnSuccess = loCertStore.FindCert(loJsonE,loCert)
IF (lnSuccess = 0) THEN
? loCertStore.LastErrorText
RELEASE loCertStore
RELEASE loJsonE
RELEASE loCert
CANCEL
ENDIF
? "Found certificate: " + loCert.SubjectDN
RELEASE loCertStore
RELEASE loJsonE
RELEASE loCert