Sample code for 30+ languages & platforms
DataFlex

Load Certificate from Smartcard in Reader (or from USB Token)

See more Certificates Examples

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.)

Chilkat DataFlex Downloads

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Boolean iSuccess
    Handle hoCert
    String sTemp1

    Move False To iSuccess

    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