Visual FoxPro
Visual FoxPro
Find Certificate by Email Address
Locate the certificate containing the specified email address in either the RFC822 Name or the Subject.Note: This example requires Chilkat v10.1.2 or later.
Chilkat Visual FoxPro Downloads
LOCAL lnSuccess
LOCAL loCertStore
LOCAL lnReadOnly
LOCAL loJson
LOCAL lcEmail_address
LOCAL loCert
lnSuccess = 0
loCertStore = CreateObject('Chilkat.CertStore')
* This opens the Current User certificate store on Windows,
* On MacOS and iOS it opens the default Keychain.
lnReadOnly = 1
lnSuccess = loCertStore.OpenCurrentUserStore(lnReadOnly)
IF (lnSuccess = 0) THEN
? loCertStore.LastErrorText
RELEASE loCertStore
CANCEL
ENDIF
* Locate the certificate containing the specified email address in either the RFC822 Name or the Subject.
loJson = CreateObject('Chilkat.JsonObject')
lcEmail_address = "harold@example.com"
loJson.UpdateString("email",lcEmail_address)
loCert = CreateObject('Chilkat.Cert')
lnSuccess = loCertStore.FindCert(loJson,loCert)
IF (lnSuccess = 1) THEN
* Show the full distinguished name of the certificate.
? "Found: " + loCert.SubjectDN
ELSE
? "Not found."
ENDIF
RELEASE loCertStore
RELEASE loJson
RELEASE loCert