Visual FoxPro
Visual FoxPro
Validate a Smartcard PIN
See more Certificates Examples
Validates a smartcard PIN. This example only runs on Windows and requires Chilkat v9.5.0.77 or greater.Chilkat Visual FoxPro Downloads
LOCAL lnSuccess
LOCAL loCert
LOCAL lnPinValid
lnSuccess = 0
* Note: Requires Chilkat v9.5.0.77 or greater.
loCert = CreateObject('Chilkat.Cert')
loCert.SmartCardPin = "000000"
* Load the certificate on the smartcard currently in the reader (or on the USB token).
* Pass an empty string to allow Chilkat to automatically choose the CSP (Cryptographi Service Provider).
* See Load Certificate on Smartcard for information about explicitly selecting a particular CSP.
lnSuccess = loCert.LoadFromSmartcard("")
IF (lnSuccess <> 1) THEN
? loCert.LastErrorText
RELEASE loCert
CANCEL
ENDIF
* Check to see if the SmartCardPin property contains the valid PIN for the smartcard.
lnPinValid = loCert.CheckSmartCardPin()
IF (lnPinValid < 0) THEN
? "Unable to check the PIN validity."
? loCert.LastErrorText
RELEASE loCert
CANCEL
ENDIF
IF (lnPinValid = 1) THEN
? "PIN is valid."
ELSE
? "PIN is invalid."
ENDIF
RELEASE loCert