Visual FoxPro
Visual FoxPro
Find Certificate by Subject OU (Organizational Unit)
See more Cert Store Examples
Demonstrates how to find a certificate having the specified subject organizational unit (OU).Note: Requires Chilkat v10.1.2 or later.
Chilkat Visual FoxPro Downloads
LOCAL lnSuccess
LOCAL loCertStore
LOCAL lnReadOnly
LOCAL loJson
LOCAL lcOu
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 = 0
lnSuccess = loCertStore.OpenCurrentUserStore(lnReadOnly)
IF (lnSuccess = 0) THEN
? loCertStore.LastErrorText
RELEASE loCertStore
CANCEL
ENDIF
* Find the certificate having a Subject OU = "Secretaria da Receita Federal do Brasil - RFB".
loJson = CreateObject('Chilkat.JsonObject')
lcOu = "Secretaria da Receita Federal do Brasil - RFB"
loJson.UpdateString("OU",lcOu)
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