(DataFlex) Load Certificate from Smartcard in Reader (or from USB Token)
Demonstrates how to load the certificate that is on the smartcard currently inserted into the smartcard reader. (Also can load the smartcard on a USB token.)
Use ChilkatAx-win32.pkg
Procedure Test
Handle hoCert
Boolean iSuccess
String sTemp1
Get Create (RefClass(cComChilkatCert)) To hoCert
If (Not(IsComObjectCreated(hoCert))) Begin
Send CreateComObject of hoCert
End
// If you know the smart card PIN, set it prior to loading from the smartcard/USB token.
Set ComSmartCardPin Of hoCert To "12345678"
// Pass an empty string to allow Chilkat to discover the smart card or USB token automatically.
Get ComLoadFromSmartcard Of hoCert "" To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoCert To sTemp1
Showln sTemp1
Procedure_Return
End
Get ComSubjectCN Of hoCert To sTemp1
Showln "Cert loaded from smartcard: " sTemp1
End_Procedure
|