sdi_if.h
Last updated: 13-Jun-2025
Go to the documentation of this file.
1Â /**************************************************************************** 2Â * Product: ADK Secure Data Interface (SDI) 3Â * Company: Verifone 4Â * Author: GSS R&D Germany 5Â * Content: Client (structure) interface - non-EMV part 6Â ****************************************************************************/ 7Â #ifndef CLIENT_SDI_IF_H_ 8Â #define CLIENT_SDI_IF_H_ 9Â 10Â #ifndef DOXYGEN 11Â #ifdef __cplusplus 12Â #endif 13Â #include <vector> 14Â #include <string> 15Â #include <stdint.h> 16Â #include <emv/EMV_Common_Interface.h> // for EMV_ADK_INFO 17Â #include <sysinfo/sysinfo.h> // for property enumerations 18Â #include <html/prt.h> // for printer property enumerations 19Â 20Â namespace libsdi { 21Â 25Â enum SDI_SW12 26Â { 27Â SDI_SW12_NONE = 0, 28Â SDI_SW12_SUCCESS = 0x9000, 29Â 30Â SDI_SW12_TAG_ERROR = 0x6200, 31Â SDI_SW12_TAG_LENGTH_ERROR = 0x6300, 32Â SDI_SW12_EXEC_ERROR = 0x6400, 33Â SDI_SW12_CANCELED_BY_USER = 0x6405, 34Â SDI_SW12_BUSY = 0x640A, 35Â SDI_SW12_TIMEOUT_PIN_ENTRY = 0x640C, 36Â SDI_SW12_TIMEOUT_CARD_REMOVAL = 0x64F7, 37Â SDI_SW12_INTERCHAR_PIN_ENTRY = 0x64F8, 38Â SDI_SW12_COMMAND_NOT_ALLOWED = 0x64F9, 39Â SDI_SW12_MAIN_CONNECTION_USED = 0x64FA, 40Â SDI_SW12_INVALID_FILE_CONTENT = 0x64FB, 41Â SDI_SW12_FILE_ACCESS_ERROR = 0x64FC, 42Â SDI_SW12_LOGIC_ERROR = 0x64FD, 43Â SDI_SW12_SDI_PARAMETER_ERROR = 0x64FE, 44Â SDI_SW12_LUHN_CHECK_FAILED = 0x64FF, 45Â SDI_SW12_EXECUTION_ABORTED = 0x6500, 46Â SDI_SW12_EXECUTION_TIMEOUT = 0x6600, 47Â SDI_SW12_MESSAGE_LENGTH_ERROR = 0x6700, 48Â 49Â SDI_SW12_NO_SDI_PLUGIN_AVAILABLE = 0x6800, 50Â SDI_SW12_UNKNOWN_PLUGIN_ID = 0x6801, 51Â SDI_SW12_UNKNOWN_PLUGING_ID = 0x6801, 52Â SDI_SW12_INVALID_PLUGIN_RESPONSE = 0x6802, 53Â 54Â SDI_SW12_EPP_CONNECTION_ERROR = 0x6900, 55Â 56Â SDI_SW12_UNKNOWN_INS_BYTE = 0x6D00, 57Â SDI_SW12_UNKNOWN_CLA_BYTE = 0x6E00, 58Â 59Â SDI_SW12_CMAC_ERROR = 0x6FB0, 60Â SDI_SW12_CMAC_LENGTH_ERROR = 0x6FB1, 61Â SDI_SW12_CMAC_MISSING_ERROR = 0x6FB2, 62Â SDI_SW12_ENCRYPTION_ERROR = 0x6FB4, 63Â SDI_SW12_ENCRYPTION_LENGTH_ERROR = 0x6FB5, 64Â SDI_SW12_ENCRYPTION_MISSING_ERROR = 0x6FB6, 65Â SDI_SW12_DECRYPTION_ERROR = 0x6FB8, 66Â SDI_SW12_DECRYPTION_LENGTH_ERROR = 0x6FB9, 67Â SDI_SW12_DECRYPTION_MISSING_ERROR = 0x6FBA, 68Â 69Â SDI_SW12_EXCESSIVE_PIN_REQUESTS = 0x6FC0, 70Â SDI_SW12_LOW_BATTERY = 0x6FD0, 71Â SDI_SW12_NO_DUKPT_KEYS_LOADED = 0x6FE0, 72Â SDI_SW12_UNIT_TAMPERED = 0x6FF0, 73Â SDI_SW12_RECOVERY_MODE = 0x6FF1, 74Â 75Â SDI_SW12_PIN_BYPASSED = 0x9070, 76Â SDI_SW12_NO_MACTCH_FOR_CARD_VALIDATION = 0x9071, 77Â SDI_SW12_SMART_CARD_REMOVED = 0x9401, 78Â SDI_SW12_SMART_CARD_ERROR_TRM = 0x9402, 79Â SDI_SW12_SMART_CARD_ERROR = 0x9403, 80Â SDI_SW12_TWO_CARDS = 0x9404, 81Â SDI_SW12_SMART_CARD_ERR_INIT = 0x9405, 82Â SDI_SW12_SMART_CARD_ERR_PARAM = 0x9406, 83Â SDI_SW12_EMV_TLV_ERROR = 0x94F3, // error In TLV data object (only in relation with EMV commands) 84Â 85Â // There are from previous header version and kept for backward compatibility 86Â SDI_SW12_ERROR = 0x6400, 87Â SDI_SW12_TIMEOUT = 0x6600, 88Â SDI_SW12_NOT_ALLOWED = 0x64FD, 89Â SDI_SW12_PARAMETER_ERROR = 0x90E6 90Â }; 91Â 99Â enum SDICLIENT_ERROR 100Â { 101Â SDICLIENT_ERROR_NONE = 0, 102Â SDICLIENT_ERROR_COMMUNICATION = -1, 103Â SDICLIENT_ERROR_CONCURRENT_USE = -2, 104Â SDICLIENT_ERROR_CONNECT = -3, 105Â SDICLIENT_ERROR_OVERFLOW = -4, 106Â SDICLIENT_ERROR_PARAM = -5, 107Â SDICLIENT_ERROR_OTHER = -6, 108Â SDICLIENT_ERROR_NO_RECEIVE = -7, 109Â SDICLIENT_ERROR_NOT_SUPPORTED = -10, 111Â SDICLIENT_ERROR_NOT_ALLOWED = -11 112Â }; 113Â 114Â #define MSR_CLIENT_ERROR_OFFSET 100 115Â 116Â #define VALIDATION_CHECK_OPTION_RETURN_ALL_MATCHING_RANGES 0x01 //Return all matching card ranges. per default only the best match is returned 117Â 121Â enum SDICLIENT_ERROR getNfcClientError(); 122Â 126Â enum SDI_SW12 getNfcSW12(); 127Â 128Â struct MatchingRecord 129Â { 130Â std::string json; 131Â unsigned char expirycheck_result; 132Â unsigned char luhncheck_result; 133Â unsigned char activationcheck_result; 134Â MatchingRecord(const std::string &_json): json(_json), expirycheck_result(0xFF), luhncheck_result(0xFF), activationcheck_result(0xFF){}; 135Â }; 136Â 138Â enum SYSUploadType { 139Â SYS_UPLOAD_SOFTWARE_UPDATE, 140Â SYS_UPLOAD_CONFIG_WHITELIST, 141Â SYS_UPLOAD_CONFIG_SENSITIVE_TAGS, 142Â SYS_UPLOAD_CONFIG_CARD_RANGES, 143Â SYS_UPLOAD_INSTALL_CP_PACKAGE = 11, 144Â SYS_UPLOAD_EMV_CONFIGURATION 145Â }; 146Â 147Â 151Â class SdiBase 152Â { 153Â protected: 154Â unsigned short sw12; 155Â int additionalResultValue; 156Â SDICLIENT_ERROR clientErr; 157Â void setSdiSw12(enum SDI_SW12 s) {sw12=s;} 158Â 165Â void setClientError(int libsdiprotocol_result); 166Â 167Â public: 168Â SdiBase() : sw12(0), additionalResultValue(0), clientErr(SDICLIENT_ERROR_NONE){} 169Â enum SDI_SW12 getSdiSw12(); 170Â 175Â int getAdditionalResultValue(){return additionalResultValue;} 176Â 183Â SDICLIENT_ERROR getClientError(){return clientErr;} 184Â 195Â enum SDI_SW12 receiveSW12(); 196Â 200Â void clear() 201Â { 202Â sw12 = SDI_SW12_NONE; 203Â additionalResultValue = 0; 204Â clientErr = SDICLIENT_ERROR_NONE; 205Â }; 206Â 210Â void importResults(const SdiBase& intermediate) 211Â { 212Â sw12 = intermediate.sw12; 213Â additionalResultValue = intermediate.additionalResultValue; 214Â clientErr = intermediate.clientErr; 215Â } 216Â 217Â struct PluginResult 218Â { 219Â int32_t pluginId; 220Â int32_t responseCode; 223Â std::vector<unsigned char> responseData; 225Â }; 226Â 227Â private: 228Â // make SdiBase non-copyable because some subclasses hold pointers and should not be copied 229Â SdiBase(const SdiBase&); 230Â SdiBase& operator=(const SdiBase&); 231Â // since C++11 we have to avoid the move, too 232Â #if __cplusplus >= 201103L 233Â SdiBase(const SdiBase&&); 234Â SdiBase& operator=(SdiBase&&); 235Â #endif 236Â }; 237Â 238Â 239Â 265Â class SdiCmd: public SdiBase 266Â { 267Â protected: 268Â void* dataIn; 269Â void* dataOut; 270Â 271Â public: 272Â SdiCmd(); 273Â virtual ~SdiCmd(); 274Â 292Â enum SDI_SW12 sendReceive(unsigned char cla, unsigned char ins, 293Â unsigned char p1 = 0, unsigned char p2 = 0, 294Â unsigned maxResponseSize = 2048); 295Â 308Â int send(unsigned char cla, unsigned char ins, 309Â unsigned char p1 = 0, unsigned char p2 = 0); 310Â 319Â enum SDI_SW12 receive(unsigned maxResponseSize = 2048); 320Â 321Â // generic setters modify #dataIn before command execution 334Â void set(const char* path, int value, unsigned fixedLength = 0); 335Â 348Â void set(const char* path, uint32_t value, unsigned fixedLength = 0); 349Â 360Â void set(const char* path, const unsigned char* data, unsigned dataLen); 361Â 371Â inline void set(const char* path, unsigned char byteValue) 372Â { 373Â set(path, &byteValue, 1); 374Â } 375Â 385Â void set(const char* path, const std::vector<unsigned char>& data); 386Â 396Â void set(const char* path, const std::string& value); 397Â 406Â void setCommandDestination(bool epp, bool force = false); 407Â 411Â virtual void clear(); 412Â 419Â virtual void clear(const char* path); 420Â 424Â virtual void clearResults(); 425Â 433Â void importResults(const SdiCmd& intermediate); 434Â 442Â void importResults(const unsigned char* sw12, const unsigned char* tlvData, unsigned tlvSize); 443Â 444Â // generic getter to read from dataOut after command execution 452Â bool get(const char* path, int& value); 453Â 461Â bool get(const char* path, uint32_t& value); 462Â 471Â int get(const char* path, unsigned char* buffer, unsigned bufferSize); 472Â 480Â inline bool get(const char* path, unsigned char& value) 481Â { 482Â return get(path, &value, 1) == 1; 483Â } 484Â 492Â bool get(const char* path, std::vector<unsigned char>& buffer); 493Â 501Â bool get(const char* path, std::string& value); 502Â 509Â std::string getString(const char* path); 510Â }; 511Â 512Â class SDI: public SdiBase 513Â { 514Â public: 515Â 525Â bool getDateTime(unsigned char* buffer); 526Â 536Â bool setDateTime(const unsigned char* dateTime); 537Â 545Â unsigned char getLanguage(); 546Â 554Â bool setLanguage(unsigned char languageId); 555Â 568Â unsigned char getCardDataEntryDeactivation(); 569Â 582Â bool setCardDataEntryDeactivation(unsigned char value); 583Â 593Â unsigned char getCardDataEntryMode(); 594Â 604Â bool setCardDataEntryMode(unsigned char value); 605Â 613Â bool setIdleText(std::string text, bool epp = true); 614Â 623Â bool showMacDesktop(bool epp = true); 624Â 635Â int getProperty(enum vfisysinfo::SYSPropertyInt p, bool epp = false); // 20 1A 00 00 636Â 647Â enum vfisysinfo::sysError getProperty(enum vfisysinfo::SYSPropertyInt p, int& value, bool epp = false); // 20 1A 00 00 648Â 659Â enum vfisysinfo::sysError setProperty(enum vfisysinfo::SYSPropertyInt p, int value, bool epp = false); // 20 19 00 00 660Â 671Â std::string getProperty(enum vfisysinfo::SYSPropertyString p, bool epp = false); // 20 1A 00 01 672Â 683Â enum vfisysinfo::sysError getProperty(enum vfisysinfo::SYSPropertyString p, std::string& value, bool epp = false); 684Â 695Â enum vfisysinfo::sysError setProperty(enum vfisysinfo::SYSPropertyString p, const std::string& value, bool epp = false); // 20 19 00 01 696Â 703Â std::string getVersionInfo(bool epp = false); 704Â 711Â bool checkForUpdate(unsigned char updateKind); 712Â 719Â bool waitCardRemoval(unsigned seconds); 720Â 729Â int sendWaitCardRemoval(unsigned seconds); 730Â 731Â // Data Interface (without crypto handle) 732Â 736Â void clearDataStore(); 737Â 748Â bool vclRegistartSRED(std::vector<unsigned char>& track1, 749Â std::vector<unsigned char>& track2, 750Â std::vector<unsigned char>& track3); 751Â 759Â bool vclStatusRequest(std::vector<unsigned char>& vclStatus); 760Â 771Â bool vclAdvanceDDK(std::vector<unsigned char>& track1, 772Â std::vector<unsigned char>& track2, 773Â std::vector<unsigned char>& track3); 774Â 786Â bool vclRequestEParms(std::vector <unsigned char>& eParms); 787Â 798Â std::string vclGetDiagnosticData(unsigned char format = 1, 799Â unsigned char pageNumber = 0); 800Â 807Â int vclGetKeyDerivationMode(); 808Â 819Â bool vclOverrideMessageQuery(std::vector<unsigned char>& track1, 820Â std::vector<unsigned char>& track2, 821Â std::vector<unsigned char>& track3); 822Â 831Â bool vclKsnRequest(std::string& ksn); 832Â 840Â bool vclKmailinRequest(); 841Â 852Â libsdi::SDI_SW12 pluginCommand(const unsigned char plugin, const unsigned char cmd, 853Â const std::vector<unsigned char>& data, 854Â std::vector<unsigned char>& response); 855Â 865Â bool setManualPAN(const std::vector<unsigned char>& pan); 866Â 876Â bool setManualPAN(const std::string& pan); 877Â 891Â libsdi::SDI_SW12 performValidationChecks(std::vector<MatchingRecord>& records, 892Â const std::vector<unsigned char>& currentDate, 893Â const unsigned char options = 0, 894Â const std::vector<unsigned char> IIN = std::vector<unsigned char>()); 895Â 903Â libsdi::SDI_SW12 getValidationInfo(std::string& info); 904Â 914Â libsdi::SDI_SW12 sysUploadStart(const std::string& filename, 915Â SYSUploadType type, 916Â bool epp = false); 917Â 926Â libsdi::SDI_SW12 sysUploadTransfer(const std::vector<unsigned char>& packet, 927Â unsigned packet_no, 928Â bool epp = false); 929Â 941Â libsdi::SDI_SW12 sysUploadFinalize(const std::vector<unsigned char>* md5 = NULL, 942Â const std::vector<unsigned char>* mac = NULL, 943Â bool epp = false); 944Â 951Â bool sysShutdown(bool epp = false); 952Â 959Â bool sysReboot(bool epp = false); 960Â 968Â bool sysSleep(bool epp = false); 969Â 977Â bool sysHybernate(bool epp = false); 978Â 984Â bool installSponsorCert(const std::vector<unsigned char>& cert); 985Â 995Â bool getLastInstallError(std::string& json, std::string& bundle, std::string& package, bool epp = false); 996Â 997Â 1002Â void externalButton(void); 1003Â 1016Â bool enableEpp(int& status); 1017Â 1030Â bool disableEpp(int& status); 1031Â 1036Â bool factoryReset(); 1037Â 1044Â bool readCertificate(const std::string& name, std::vector<unsigned char>& certificate); 1045Â 1052Â bool setUseCurrencyAbbreviation(const unsigned char* currency, bool useAbbreviation); 1053Â 1060Â bool setUseCurrencyAbbreviation(unsigned currency, bool useAbbreviation); 1061Â 1071Â bool msrSwitchLeds(int led1, int led2, int led3, int duration); 1072Â 1079Â bool msrSetSensitivty(unsigned char level, bool epp = false); 1080Â 1081Â 1091Â enum vfiprt::PrtError setPrinterProperty(enum vfiprt::PrtPropertyInt p, int value); // 25 00 00 00 1092Â 1102Â enum vfiprt::PrtError setPrinterProperty(enum vfiprt::PrtPropertyString p, const std::string& value); // 25 00 00 01 1103Â 1113Â enum vfiprt::PrtError getPrinterProperty(enum vfiprt::PrtPropertyInt p, int& value); // 25 01 00 00 1114Â 1124Â enum vfiprt::PrtError getPrinterProperty(enum vfiprt::PrtPropertyString p, std::string& value); // 25 01 00 01 1125Â 1133Â enum vfiprt::PrtError printHtml(const std::string& html, bool landscape = false); 1134Â 1143Â enum vfiprt::PrtError printBitmap(const int width, const int height, const std::vector<unsigned char>& data); 1144Â 1145Â private: 1146Â bool sysPower(unsigned char p2, bool epp); 1147Â bool enableEpp(int& status, unsigned char p2); 1148Â 1149Â }; // class SDI 1150Â 1151Â 1170Â class CardDetection: public SdiCmd 1171Â { 1172Â public: 1173Â const static unsigned char SDI_TEC_CHIP = 1; // ISO 7816 1174Â const static unsigned char SDI_TEC_MAGN = 2; // ISO 7810 1175Â const static unsigned char SDI_TEC_CTLS = 4; // ISO 14443 1176Â const static unsigned char SDI_TEC_MANU = 8; // ITU-T E.161 1177Â 1182Â enum DetectionMode { 1183Â DETECTION_MODE_BLOCKING, 1184Â DETECTION_MODE_POLLING, 1185Â DETECTION_MODE_CALLBACK 1186Â }; 1187Â 1193Â void setDetectionMode(const enum DetectionMode mode); 1194Â 1200Â void setTecStartOptions(const std::vector<unsigned char>& opts); // see cts_StartSelection 1201Â 1207Â void setTecConfig(const std::vector<unsigned char>& opts); // see cts_SetOptions 1208Â 1214Â void setCancelButton(bool enable); 1215Â 1221Â void setCardEntryValueDeativation(unsigned char b); 1222Â 1228Â void setAlternativeInputFormat(const char* f); 1229Â 1240Â void setCardRemovalTimeout(unsigned timeout_ms); 1241Â 1248Â void setCallback(void (*cb)(unsigned char technology, void* context), void* ctx); 1249Â 1250Â 1257Â void cardDetectedCallback(unsigned char *dataIn, unsigned short sizeIn); 1258Â 1259Â 1290Â int startSelection(unsigned char supportedTechnologies, unsigned seconds); 1291Â 1301Â enum libsdi::SDI_SW12 stopSelection(); 1302Â 1340Â unsigned char receiveTechnology(); 1341Â 1350Â bool cardReadAtEpp(); 1351Â 1360Â unsigned char pollTechnology(); 1361Â 1369Â enum libsdi::SDI_SW12 addTechnology(unsigned char technology, const std::vector<unsigned char>& opts); 1370Â 1377Â enum libsdi::SDI_SW12 removeTechnology(unsigned char technology); 1378Â 1383Â std::string getPan(); 1384Â 1389Â std::string getTrack2(); 1390Â 1396Â int getTrack2Bin(std::vector<unsigned char>& data); 1397Â 1402Â std::string getCardholderName(); 1403Â 1408Â std::string getServiceCode(); 1409Â 1414Â std::string getTrack1(); 1415Â 1424Â int getPluginResponseData(std::vector<unsigned char>& data); 1425Â 1439Â int getPluginResponseData(unsigned index, 1440Â int32_t& pluginId, 1441Â int32_t& pluginResponseCode, 1442Â std::vector<unsigned char>& data); 1443Â 1450Â bool getPluginResponseData(std::vector<PluginResult>& results); 1451Â 1458Â std::string getString(unsigned CTS_DATA_TAG); 1459Â 1475Â unsigned char getValue(unsigned CTS_DATA_TAG, unsigned char defaultValue); 1476Â 1484Â unsigned char getValue(unsigned CTS_DATA_TAG, int n, unsigned char defaultValue); 1485Â 1491Â int getData(std::vector<unsigned char>& data); 1492Â 1500Â int getData(unsigned CTS_DATA_TAG, std::vector<unsigned char>& data); 1501Â 1511Â int getData(unsigned CTS_DATA_TAG, int n, std::vector<unsigned char>& data); 1512Â 1521Â int getTecselData(std::vector<unsigned char>& data); 1522Â 1537Â int startMsrRead(unsigned timeout_sec); 1538Â 1562Â int msrSetOptions(const std::vector<unsigned char>& opts); 1563Â 1572Â int msrGetTrackStatus(int track); 1573Â 1580Â int msrGetCardSpecificToken(std::vector<unsigned char>& token); 1581Â 1582Â CardDetection(); 1583Â ~CardDetection(); 1584Â 1592Â virtual void clear(); 1593Â 1594Â private: 1595Â void (*callback)(unsigned char technology, void* context); 1596Â void* context; 1597Â enum DetectionMode mode; 1598Â }; 1599Â 1603Â class PED: public SdiCmd 1604Â { 1605Â public: 1609Â enum NavigatorMode 1610Â { 1611Â NAVIGATOR_MODE_OFF, 1612Â NAVIGATOR_MODE_DOUBLE_TAB, 1613Â NAVIGATOR_MODE_TACTILE_BUTTON 1614Â }; 1615Â 1624Â void setTimeout(unsigned seconds); 1625Â 1633Â bool setDefaultTimeout(unsigned seconds); 1634Â 1650Â void setTouchCoordinates(const unsigned char* array, unsigned size); 1651Â 1656Â void setNavigatorMode(enum NavigatorMode mode); 1657Â 1668Â void setPinDigitCountMinMax(unsigned char min, unsigned char max); 1669Â 1676Â void setLanguage(unsigned char lang); 1677Â 1684Â void setAmount(const unsigned char* amount); 1685Â 1692Â void setCurrency(const unsigned char* currency); 1693Â 1701Â void setAppLabel(const std::string& appLabel); 1702Â 1703Â 1730Â int startPinInput(); 1731Â 1742Â int startPinInput(bool enablePinBypass); 1743Â 1763Â bool startPinEntry(unsigned pinBypassKey = 0); 1764Â 1771Â bool pollPinEntry(std::vector<unsigned char>& status); 1772Â 1778Â bool stopPinEntry(); 1779Â 1788Â bool setPinInputClearKeyMode(bool clearAllDigits); 1789Â 1796Â void setClearKeyMode(bool clearAllDigits); 1797Â 1804Â void setPinBypassKeyAndMode(unsigned char value); 1805Â 1812Â void setAutoConfirmation(bool enable); 1813Â 1820Â void setDialogOptions(uint32_t options); 1821Â 1828Â void setIntercharTimeout(uint32_t millis); 1829Â 1838Â void setHeaderLabel(const std::string& label); 1839Â 1846Â void setEchoChar(uint32_t unicode); 1847Â 1866Â bool sendPinInputParameters(bool epp = true); 1867Â 1874Â enum SDI_SW12 receiveGetPinResult(); 1875Â 1884Â bool getPinBypassKey(unsigned char& value); 1885Â }; 1886Â 1895Â class SdiCrypt: public SdiBase 1896Â { 1897Â public: 1898Â // SDI Crypto Interface 1899Â SdiCrypt(); 1900Â ~SdiCrypt(); 1901Â 1910Â bool open(const char* hostName); 1911Â 1918Â bool close(); 1919Â 1925Â bool isOpen() const; 1926Â 1933Â uint32_t getCryptoHandle(); 1934Â 1946Â bool encrypt(const std::vector<unsigned char>& data, 1947Â std::vector<unsigned char>& encrypted); 1948Â 1960Â bool decrypt(const std::vector<unsigned char>& encrypted, 1961Â std::vector<unsigned char>& decrypted); 1962Â 1974Â bool sign(const std::vector<unsigned char>& data, 1975Â std::vector<unsigned char>& signature); 1976Â 1988Â bool verify(const std::vector<unsigned char>& data, 1989Â const std::vector<unsigned char>& signature); 1990Â 2005Â bool updateKey(unsigned char keyType, const std::vector<unsigned char>& keyData, 2006Â std::vector<unsigned char>* proprietaryData = NULL, 2007Â const unsigned char AS2805 = 0, 2008Â std::vector<unsigned char>* KCV = NULL); 2009Â 2021Â bool setKeySetId(uint32_t ksid, uint32_t mksid = 0, bool asAttribute = false); 2022Â 2031Â bool getEncryptedPin(unsigned char pinBlockFormat, 2032Â std::vector<unsigned char>& pinBlock, 2033Â bool requestZeroPinBlock = false); 2034Â 2040Â std::string getKeyInventory(); 2041Â 2050Â bool getKeyData(unsigned char keyType, std::vector<unsigned char>& keyData, unsigned char kekFlag = 0); 2051Â 2058Â std::string getStatus(); 2059Â 2069Â std::string getStatus(std::string hostName); 2070Â 2071Â 2078Â static std::string getVersions(int& additionalResult); 2079Â 2090Â void setInitialVector(const std::vector<unsigned char>& iv) 2091Â { 2092Â initialVector = iv; 2093Â } 2094Â 2100Â void getInitialVector(std::vector<unsigned char>& iv) const 2101Â { 2102Â iv = initialVector; 2103Â } 2104Â 2105Â 2111Â void getKeySerialNumber(std::vector<unsigned char>& ksn) const 2112Â { 2113Â ksn = keySerialNumber; 2114Â } 2115Â 2119Â struct Placeholder 2120Â { 2121Â std::vector<unsigned char> tagList; 2122Â std::vector<unsigned char> applicationData; 2123Â std::vector<unsigned char> dataOptions; 2124Â }; 2125Â 2140Â bool getEncData(const Placeholder& descriptor, 2141Â std::vector<unsigned char>& encrypted, 2142Â bool useStoredData = false, 2143Â bool incrementKSN = false); 2144Â 2160Â bool getEncMsgData(const std::vector<unsigned char>& messageTemplate, 2161Â const std::vector<Placeholder>& placeholder, 2162Â std::vector<unsigned char>& encrypted, 2163Â bool useStoredData = false, 2164Â bool incrementKSN = false); 2165Â 2181Â bool getMsgSignature(const std::vector<unsigned char>& messageTemplate, 2182Â const std::vector<Placeholder>& placeholder, 2183Â std::vector<unsigned char>& signature, 2184Â bool useStoredData = false, 2185Â bool incrementKSN = false); 2186Â 2194Â bool getEncTrxData(const std::vector<unsigned long> tags, std::vector<unsigned char>& data); 2195Â 2202Â bool setEncTrxData(const std::vector<unsigned char> data); 2203Â 2209Â bool endEncTrxData(); 2210Â 2211Â private: 2212Â unsigned char cryptoHandle[4]; 2213Â std::vector<unsigned char> initialVector; 2214Â std::vector<unsigned char> keySerialNumber; 2215Â uint32_t keySetId; 2216Â uint32_t masterKeySetId; 2217Â }; 2218Â 2228Â class ManualEntry: public SdiCmd 2229Â { 2230Â public: 2231Â ManualEntry(); 2232Â ~ManualEntry(); 2233Â 2240Â void setLanguage(unsigned char language); 2241Â 2242Â 2249Â int setTimeout(unsigned seconds); 2250Â 2264Â int setCvvEntryDeactivation(unsigned char cvvEntry); 2265Â 2266Â 2275Â int setCardDataEntryMode(unsigned char mode); 2276Â 2277Â 2284Â int setCvvInputString(const std::string &inputString); 2285Â 2301Â int setTouchCoordinates(const unsigned char* array, unsigned size); 2302Â 2312Â int setMimimumDigits(unsigned char minimumDigits); 2313Â 2322Â int setDoubleConfirmationMode(unsigned char mode); 2323Â 2344Â int start(); 2345Â 2362Â int receiveResult(std::string& obfuscatedPAN, std::vector<unsigned char>& token); 2363Â 2372Â int getPluginResponseData(std::vector<unsigned char>& data); 2373Â 2387Â int getPluginResponseData(unsigned index, 2388Â int32_t& pluginId, 2389Â int32_t& pluginResponseCode, 2390Â std::vector<unsigned char>& data); 2391Â 2398Â bool getPluginResponseData(std::vector<PluginResult>& results); 2399Â }; 2400Â 2446Â class Dialog: public SdiCmd 2447Â { 2448Â public: 2449Â 2456Â 2462Â const static int DIALOG_SUCCESS = 0; 2463Â 2469Â const static int DIALOG_CANCEL_PRESSED = -1; 2470Â 2476Â const static int DIALOG_TIMEOUT = -3; 2477Â 2484Â const static int DIALOG_SYS_ABORT = -8; 2485Â 2491Â const static int DIALOG_CLIENT_ERROR = -14; 2492Â 2498Â const static int DIALOG_SDI_SW12 = -15; 2499Â 2504Â const static int DIALOG_NO_ASYNC_DIALOG = 1; 2505Â 2510Â const static int DIALOG_IN_PROGRESS = 2; 2511Â 2513Â 2520Â const static unsigned DLG_DisplayOnly = 0x00000000; 2521Â const static unsigned DLG_CancelKey = 0x00000002; 2522Â const static unsigned DLG_ClearKey = 0x00000004; 2523Â const static unsigned DLG_EnterKey = 0x00000008; 2524Â const static unsigned DLG_NoLEDs = 0x00000010; 2525Â const static unsigned DLG_CtlsLogo = 0x00000020; 2526Â const static unsigned DLG_QuestionLogo = 0x00000040; 2527Â const static unsigned DLG_WarningLogo = 0x00000080; 2528Â const static unsigned DLG_ErrorLogo = 0x00000100; 2529Â const static unsigned DLG_SuccessLogo = 0x00000200; 2530Â const static unsigned DLG_WaitLogo = 0x00000400; 2531Â const static unsigned DLG_Async = 0x00000800; 2532Â const static unsigned DLG_StoreAsyncResult = 0x00001000; 2533Â const static unsigned DLG_HideSoftKeys = 0x00002000; 2534Â const static unsigned DLG_TextAlignLeft = 0x00004000; 2535Â const static unsigned DLG_TextAlignRight = 0x00008000; 2536Â const static unsigned DLG_TextAlignTop = 0x00010000; 2537Â const static unsigned DLG_TextAlignButton = 0x00020000; 2538Â const static unsigned DLG_NoHeader = 0x00040000; 2539Â const static unsigned DLG_ClearOnReturn = 0x00100000; 2540Â const static unsigned DLG_AbortOnCardRemove = 0x00200000; 2541Â const static unsigned DLG_IgnoreExtAbort = 0x00400000; 2543Â 2550Â const static unsigned MENU_NoOpts = 0x00000000; 2551Â const static unsigned MENU_NoLEDs = 0x00000002; 2552Â const static unsigned MENU_ClearOnReturn = 0x00000004; 2553Â const static unsigned MENU_AbortOnCardRemove= 0x00000008; 2554Â const static unsigned MENU_IgnoreExtAbort = 0x00000010; 2555Â const static unsigned MENU_NoHeader = 0x00000020; 2557Â 2561Â enum REQUEST_CARD_MODE 2562Â { 2563Â REQUEST_CARD_STANDARD = 0, 2564Â REQUEST_CARD_FALLBACK = 1, 2565Â REQUEST_CARD_RETRY = 2 2566Â }; 2567Â 2576Â bool clearScreen(bool epp = true); 2577Â 2601Â int display(const std::string& text, bool epp = true); 2602Â 2626Â int secureInput(bool epp = true); 2627Â 2659Â int menu(bool epp = true); 2660Â 2678Â int requestCard(unsigned char technology, 2679Â enum REQUEST_CARD_MODE mode = REQUEST_CARD_STANDARD, 2680Â bool epp = true); 2681Â 2688Â bool idleScreen(bool epp = true); 2689Â 2705Â int captureSignature(std::vector<unsigned char>& signature, std::string& format, 2706Â bool epp = true); 2707Â 2714Â static void showLedArea(bool show); 2715Â 2737Â int htmlDialog(const std::string& fname, bool epp = true); 2738Â 2750Â int getAsyncResult(bool epp = true); 2751Â 2755Â static void abort(); 2756Â 2765Â void setTemplate(unsigned char id); 2766Â 2775Â void setInputTemplate(unsigned char id); 2776Â 2786Â void setLanguage(unsigned char language); 2787Â 2799Â void addData(const std::string& name, const std::string& value); 2800Â 2811Â void setTimeout(int seconds); 2812Â 2825Â void setOptions(unsigned options); 2826Â 2836Â void setEnterKeyLabel(const std::string& label); 2837Â 2847Â void setClearKeyLabel(const std::string& label); 2848Â 2858Â void setCancelKeyLabel(const std::string& label); 2859Â 2869Â void setUpKeyLabel(const std::string& label); 2870Â 2879Â void setDownKeyLabel(const std::string& label); 2880Â 2889Â void setHeader(const std::string& text); 2890Â 2899Â void setBeep(bool active = true); 2900Â 2910Â void addAction(const std::string& key, const std::string& action); 2911Â 2920Â void setMaskingCharacter(char c); 2921Â 2930Â void setAlternativeInputFormat(const char* f); 2931Â 2940Â void setAmount(const unsigned char* amount); 2941Â 2952Â void setCurrency(const unsigned char* currency); 2953Â 2964Â void setTransactionType(unsigned char txnType); 2965Â 2974Â void setMenuText(const std::string& text); 2975Â 2984Â void addMenuItem(const std::string& item); 2985Â 2996Â void setPreSelected(unsigned char itemNumber); 2997Â 3012Â void setAdminMenu(unsigned char adminMenu); 3013Â 3022Â unsigned char getSelected(); 3023Â 3033Â std::string get(const std::string& name); 3034Â 3047Â std::vector<std::string> getInputFieldNames(); 3048Â 3049Â private: 3050Â int startDialog(unsigned char instruction, bool epp); 3051Â }; 3052Â 3053Â } // namespace sdi 3054Â 3055Â #ifndef DOXYGEN 3056Â #endif // C++ 3057Â #endif 3058Â #endif /* CLIENT_SDI_IF_H_ */
Rate this article: