Visual FoxPro
Visual FoxPro
Find Certificate by Serial Number
See more Cert Store Examples
Demonstrates how to find a certificate having the specified hexadecimal serial number.Note: Requires Chilkat v10.1.2 or later.
Chilkat Visual FoxPro Downloads
LOCAL lnSuccess
LOCAL loCertStore
LOCAL lcArgNotUsed
LOCAL lcHexSerial
LOCAL loJson
LOCAL loCert
lnSuccess = 0
loCertStore = CreateObject('Chilkat.CertStore')
* This example will search the certs on connected USB tokens and smartcards.
lcArgNotUsed = ""
lnSuccess = loCertStore.OpenSmartcard(lcArgNotUsed)
IF (lnSuccess = 0) THEN
? loCertStore.LastErrorText
RELEASE loCertStore
CANCEL
ENDIF
* Find the certificate having a serial number = "48FC93B46055948D36A7C98A89D69416".
lcHexSerial = "48FC93B46055948D36A7C98A89D69416"
loJson = CreateObject('Chilkat.JsonObject')
loJson.UpdateString("serial",lcHexSerial)
loCert = CreateObject('Chilkat.Cert')
lnSuccess = loCertStore.FindCert(loJson,loCert)
IF (lnSuccess = 1) THEN
* Show the serial number and subject CN
? "Found: " + loCert.SerialNumber + ", " + loCert.SubjectCN
ELSE
? "Not found."
ENDIF
RELEASE loCertStore
RELEASE loJson
RELEASE loCert