> For the complete documentation index, see [llms.txt](https://sandbox-docs.verifone.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sandbox-docs.verifone.com/adk-5.0-programmers-guide/sdi__if_8h_source.md).

# sdi\_if.h

[Go to the documentation of this file.](/adk-5.0-programmers-guide/readme/files/dir_fd97ec13bcecf864d0a2538bcb52d927/dir_64d02063c70c5c9b1f1dea0f7cacc02a/sdi__if_8h.md)

```cpp
 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_CTLS_EMV_NO_CARD = 0x64F4,
 37  SDI_SW12_TIMEOUT_NO_MSR_DATA = 0x64F6,
 38  SDI_SW12_TIMEOUT_CARD_REMOVAL = 0x64F7,
 39  SDI_SW12_INTERCHAR_PIN_ENTRY = 0x64F8,
 40  SDI_SW12_COMMAND_NOT_ALLOWED = 0x64F9,
 41  SDI_SW12_MAIN_CONNECTION_USED = 0x64FA,
 42  SDI_SW12_INVALID_FILE_CONTENT = 0x64FB,
 43  SDI_SW12_FILE_ACCESS_ERROR = 0x64FC,
 44  SDI_SW12_LOGIC_ERROR = 0x64FD,
 45  SDI_SW12_SDI_PARAMETER_ERROR = 0x64FE,
 46  SDI_SW12_LUHN_CHECK_FAILED = 0x64FF,
 47  SDI_SW12_EXECUTION_ABORTED = 0x6500,
 48  SDI_SW12_EXECUTION_TIMEOUT = 0x6600,
 49  SDI_SW12_MESSAGE_LENGTH_ERROR = 0x6700,
 50 
 51  SDI_SW12_NO_SDI_PLUGIN_AVAILABLE = 0x6800,
 52  SDI_SW12_UNKNOWN_PLUGIN_ID = 0x6801,
 53  SDI_SW12_UNKNOWN_PLUGING_ID = 0x6801,
 54  SDI_SW12_INVALID_PLUGIN_RESPONSE = 0x6802,
 55 
 56  SDI_SW12_EPP_CONNECTION_ERROR = 0x6900,
 57 
 58  SDI_SW12_UNKNOWN_INS_BYTE = 0x6D00,
 59  SDI_SW12_UNKNOWN_CLA_BYTE = 0x6E00,
 60 
 61  SDI_SW12_CMAC_ERROR = 0x6FB0,
 62  SDI_SW12_CMAC_LENGTH_ERROR = 0x6FB1,
 63  SDI_SW12_CMAC_MISSING_ERROR = 0x6FB2,
 64  SDI_SW12_ENCRYPTION_ERROR = 0x6FB4,
 65  SDI_SW12_ENCRYPTION_LENGTH_ERROR = 0x6FB5,
 66  SDI_SW12_ENCRYPTION_MISSING_ERROR = 0x6FB6,
 67  SDI_SW12_DECRYPTION_ERROR = 0x6FB8,
 68  SDI_SW12_DECRYPTION_LENGTH_ERROR = 0x6FB9,
 69  SDI_SW12_DECRYPTION_MISSING_ERROR = 0x6FBA,
 70 
 71  SDI_SW12_EXCESSIVE_PIN_REQUESTS = 0x6FC0,
 72  SDI_SW12_LOW_BATTERY = 0x6FD0,
 73  SDI_SW12_NO_DUKPT_KEYS_LOADED = 0x6FE0,
 74  SDI_SW12_UNIT_TAMPERED = 0x6FF0,
 75  SDI_SW12_RECOVERY_MODE = 0x6FF1,
 76 
 77  SDI_SW12_VALIDATION_INFO_ERR_PARAM = 0x9001,
 78  SDI_SW12_VALIDATION_INFO_FILE_NOT_FOUND = 0x9002,
 79  SDI_SW12_VALIDATION_INFO_ERR_FILE_FORMAT = 0x9003,
 80 
 81  SDI_SW12_PIN_BYPASSED = 0x9070,
 82  SDI_SW12_NO_MACTCH_FOR_CARD_VALIDATION = 0x9071,
 83  SDI_SW12_SMART_CARD_REMOVED = 0x9401,
 84  SDI_SW12_SMART_CARD_ERROR_TRM = 0x9402,
 85  SDI_SW12_SMART_CARD_ERROR = 0x9403,
 86  SDI_SW12_TWO_CARDS = 0x9404,
 87  SDI_SW12_SMART_CARD_ERR_INIT = 0x9405,
 88  SDI_SW12_SMART_CARD_ERR_PARAM = 0x9406,
 89  SDI_SW12_EMV_TLV_ERROR = 0x94F3, // error In TLV data object (only in relation with EMV commands)
 90 
 91  // These are from previous header version and kept for backward compatibility
 92  SDI_SW12_ERROR = 0x6400,
 93  SDI_SW12_TIMEOUT = 0x6600,
 94  SDI_SW12_NOT_ALLOWED = 0x64FD,
 95  SDI_SW12_PARAMETER_ERROR = 0x90E6
 96 };
 97 
 105 enum SDICLIENT_ERROR
 106 {
 107  SDICLIENT_ERROR_NONE = 0,
 108  SDICLIENT_ERROR_COMMUNICATION = -1,
 109  SDICLIENT_ERROR_CONCURRENT_USE = -2,
 110  SDICLIENT_ERROR_CONNECT = -3,
 111  SDICLIENT_ERROR_OVERFLOW = -4,
 112  SDICLIENT_ERROR_PARAM = -5,
 113  SDICLIENT_ERROR_OTHER = -6,
 114  SDICLIENT_ERROR_NO_RECEIVE = -7,
 115  SDICLIENT_ERROR_NOT_SUPPORTED = -10,
 117  SDICLIENT_ERROR_NOT_ALLOWED = -11
 118 };
 119 
 120 #define MSR_CLIENT_ERROR_OFFSET 100 
 121 
 122 #define VALIDATION_CHECK_OPTION_RETURN_ALL_MATCHING_RANGES 0x01 //Return all matching card ranges. per default only the best match is returned
 123 
 127 enum SDICLIENT_ERROR getNfcClientError();
 128 
 132 enum SDI_SW12 getNfcSW12();
 133 
 134 struct MatchingRecord
 135 {
 136  std::string json;
 137  unsigned char expirycheck_result;
 138  unsigned char luhncheck_result;
 139  unsigned char activationcheck_result;
 140  MatchingRecord(const std::string &_json): json(_json), expirycheck_result(0xFF), luhncheck_result(0xFF), activationcheck_result(0xFF){};
 141 };
 142 
 144 enum SYSUploadType
 145 {
 146  SYS_UPLOAD_SOFTWARE_UPDATE = 0,
 147  SYS_UPLOAD_CONFIG_WHITELIST = 1,
 148  SYS_UPLOAD_CONFIG_SENSITIVE_TAGS = 2,
 149  SYS_UPLOAD_CONFIG_CARD_RANGES = 3,
 150  SYS_UPLOAD_INSTALL_CP_PACKAGE = 11,
 151  SYS_UPLOAD_EMV_CONFIGURATION = 12,
 152  SYS_UPLOAD_UVRK_PACKAGE = 13,
 153 };
 154 
 155 
 159 class SdiBase
 160 {
 161 protected:
 162  unsigned short sw12;
 163  int additionalResultValue;
 164  SDICLIENT_ERROR clientErr;
 165  void setSdiSw12(enum SDI_SW12 s) {sw12=s;}
 166 
 173  void setClientError(int libsdiprotocol_result);
 174 
 175 public:
 176  SdiBase() : sw12(0), additionalResultValue(0), clientErr(SDICLIENT_ERROR_NONE){}
 177  enum SDI_SW12 getSdiSw12();
 178 
 184  int getAdditionalResultValue(){return additionalResultValue;}
 185 
 192  SDICLIENT_ERROR getClientError(){return clientErr;}
 193 
 204  enum SDI_SW12 receiveSW12();
 205 
 209  void clear()
 210  {
 211  sw12 = SDI_SW12_NONE;
 212  additionalResultValue = 0;
 213  clientErr = SDICLIENT_ERROR_NONE;
 214  };
 215 
 219  void importResults(const SdiBase& intermediate)
 220  {
 221  sw12 = intermediate.sw12;
 222  additionalResultValue = intermediate.additionalResultValue;
 223  clientErr = intermediate.clientErr;
 224  }
 225 
 226  struct PluginResult
 227  {
 228  int32_t pluginId;
 229  int32_t responseCode;
 232  std::vector<unsigned char> responseData;
 234  };
 235 
 236 private:
 237  // make SdiBase non-copyable because some subclasses hold pointers and should not be copied
 238  SdiBase(const SdiBase&);
 239  SdiBase& operator=(const SdiBase&);
 240  // since C++11 we have to avoid the move, too
 241 #if __cplusplus >= 201103L
 242  SdiBase(const SdiBase&&);
 243  SdiBase& operator=(SdiBase&&);
 244 #endif
 245 };
 246 
 247 
 248 
 274 class SdiCmd: public SdiBase
 275 {
 276 protected:
 277  void* dataIn;
 278  void* dataOut;
 279 
 280 public:
 281  SdiCmd();
 282  virtual ~SdiCmd();
 283 
 301  enum SDI_SW12 sendReceive(unsigned char cla, unsigned char ins,
 302  unsigned char p1 = 0, unsigned char p2 = 0,
 303  unsigned maxResponseSize = 2048);
 304 
 317  int send(unsigned char cla, unsigned char ins,
 318  unsigned char p1 = 0, unsigned char p2 = 0);
 319 
 328  enum SDI_SW12 receive(unsigned maxResponseSize = 2048);
 329 
 330  // generic setters modify #dataIn before command execution
 343  void set(const char* path, int value, unsigned fixedLength = 0);
 344 
 357  void set(const char* path, uint32_t value, unsigned fixedLength = 0);
 358 
 369  void set(const char* path, const unsigned char* data, unsigned dataLen);
 370 
 380  inline void set(const char* path, unsigned char byteValue)
 381  {
 382  set(path, &byteValue, 1);
 383  }
 384 
 394  void set(const char* path, const std::vector<unsigned char>& data);
 395 
 405  void set(const char* path, const std::string& value);
 406 
 415  void setCommandDestination(bool epp, bool force = false);
 416 
 420  virtual void clear();
 421 
 428  virtual void clear(const char* path);
 429 
 433  virtual void clearResults();
 434 
 442  void importResults(const SdiCmd& intermediate);
 443 
 451  void importResults(const unsigned char* sw12, const unsigned char* tlvData, unsigned tlvSize);
 452 
 453  // generic getter to read from dataOut after command execution
 461  bool get(const char* path, int& value);
 462 
 470  bool get(const char* path, uint32_t& value);
 471 
 480  int get(const char* path, unsigned char* buffer, unsigned bufferSize);
 481 
 489  inline bool get(const char* path, unsigned char& value)
 490  {
 491  return get(path, &value, 1) == 1;
 492  }
 493 
 501  bool get(const char* path, std::vector<unsigned char>& buffer);
 502 
 510  bool get(const char* path, std::string& value);
 511 
 518  std::string getString(const char* path);
 519 };
 520 
 521 class SDI: public SdiBase
 522 {
 523 public:
 531  bool releasePaymentLock();
 532 
 542  bool getDateTime(unsigned char* buffer);
 543 
 553  bool setDateTime(const unsigned char* dateTime);
 554 
 562  unsigned char getLanguage();
 563 
 571  bool setLanguage(unsigned char languageId);
 572 
 585  unsigned char getCardDataEntryDeactivation();
 586 
 599  bool setCardDataEntryDeactivation(unsigned char value);
 600 
 610  unsigned char getCardDataEntryMode();
 611 
 621  bool setCardDataEntryMode(unsigned char value);
 622 
 630  bool setIdleText(std::string text, bool epp = true);
 631 
 640  bool showMacDesktop(bool epp = true);
 641 
 652  int getProperty(enum vfisysinfo::SYSPropertyInt p, bool epp = false); // 20 1A 00 00
 653 
 664  enum vfisysinfo::sysError getProperty(enum vfisysinfo::SYSPropertyInt p, int& value, bool epp = false); // 20 1A 00 00
 665 
 676  enum vfisysinfo::sysError setProperty(enum vfisysinfo::SYSPropertyInt p, int value, bool epp = false); // 20 19 00 00
 677 
 688  std::string getProperty(enum vfisysinfo::SYSPropertyString p, bool epp = false); // 20 1A 00 01
 689 
 700  enum vfisysinfo::sysError getProperty(enum vfisysinfo::SYSPropertyString p, std::string& value, bool epp = false);
 701 
 712  enum vfisysinfo::sysError setProperty(enum vfisysinfo::SYSPropertyString p, const std::string& value, bool epp = false); // 20 19 00 01
 713 
 720  std::string getVersionInfo(bool epp = false);
 721 
 728  bool checkForUpdate(unsigned char updateKind);
 729 
 736  bool waitCardRemoval(unsigned seconds);
 737 
 750  bool waitCardRemoval(unsigned seconds, bool& cardStillPresent);
 751 
 760  int sendWaitCardRemoval(unsigned seconds);
 761 
 762  // Data Interface (without crypto handle)
 763 
 767  void clearDataStore();
 768 
 779  bool vclRegistartSRED(std::vector<unsigned char>& track1,
 780  std::vector<unsigned char>& track2,
 781  std::vector<unsigned char>& track3);
 782 
 790  bool vclStatusRequest(std::vector<unsigned char>& vclStatus);
 791 
 802  bool vclAdvanceDDK(std::vector<unsigned char>& track1,
 803  std::vector<unsigned char>& track2,
 804  std::vector<unsigned char>& track3);
 805 
 817  bool vclRequestEParms(std::vector <unsigned char>& eParms);
 818 
 829  std::string vclGetDiagnosticData(unsigned char format = 1,
 830  unsigned char pageNumber = 0);
 831 
 838  int vclGetKeyDerivationMode();
 839 
 850  bool vclOverrideMessageQuery(std::vector<unsigned char>& track1,
 851  std::vector<unsigned char>& track2,
 852  std::vector<unsigned char>& track3);
 853 
 862  bool vclKsnRequest(std::string& ksn);
 863 
 871  bool vclKmailinRequest();
 872 
 883  libsdi::SDI_SW12 pluginCommand(const unsigned char plugin, const unsigned char cmd,
 884  const std::vector<unsigned char>& data,
 885  std::vector<unsigned char>& response);
 886 
 896  bool setManualPAN(const std::vector<unsigned char>& pan);
 897 
 907  bool setManualPAN(const std::string& pan);
 908 
 922  libsdi::SDI_SW12 performValidationChecks(std::vector<MatchingRecord>& records,
 923  const std::vector<unsigned char>& currentDate,
 924  const unsigned char options = 0,
 925  const std::vector<unsigned char> IIN = std::vector<unsigned char>());
 926 
 934  libsdi::SDI_SW12 getValidationInfo(std::string& info);
 935 
 951  libsdi::SDI_SW12 sysLockPayment();
 952 
 964  libsdi::SDI_SW12 sysResetLink();
 965 
 975  bool sysRegisterLoggingCallback(void (*logCallback)(const char*, void*),
 976  void* context,
 977  unsigned char options = 0);
 978 
 988  libsdi::SDI_SW12 sysUploadStart(const std::string& filename,
 989  SYSUploadType type,
 990  bool epp = false);
 991 
 1000  libsdi::SDI_SW12 sysUploadTransfer(const std::vector<unsigned char>& packet,
 1001  unsigned packet_no,
 1002  bool epp = false);
 1003 
 1015  libsdi::SDI_SW12 sysUploadFinalize(const std::vector<unsigned char>* md5 = NULL,
 1016  const std::vector<unsigned char>* mac = NULL,
 1017  bool epp = false);
 1018 
 1025  bool sysShutdown(bool epp = false);
 1026 
 1033  bool sysReboot(bool epp = false);
 1034 
 1042  bool sysSleep(bool epp = false);
 1043 
 1051  bool sysHybernate(bool epp = false);
 1052 
 1058  bool installSponsorCert(const std::vector<unsigned char>& cert);
 1059 
 1069  bool getLastInstallError(std::string& json, std::string& bundle, std::string& package, bool epp = false);
 1070 
 1071 
 1076  void externalButton(void);
 1077 
 1090  bool enableEpp(int& status);
 1091 
 1104  bool disableEpp(int& status);
 1105 
 1110  bool factoryReset();
 1111 
 1118  bool readCertificate(const std::string& name, std::vector<unsigned char>& certificate);
 1119 
 1126  bool setUseCurrencyAbbreviation(const unsigned char* currency, bool useAbbreviation);
 1127 
 1134  bool setUseCurrencyAbbreviation(unsigned currency, bool useAbbreviation);
 1135 
 1146  libsdi::SDI_SW12 sysGetStatisticCounters(std::string& counters);
 1147 
 1157  bool msrSwitchLeds(int led1, int led2, int led3, int duration);
 1158 
 1165  bool msrSetSensitivty(unsigned char level, bool epp = false);
 1166 
 1167 
 1177  enum vfiprt::PrtError setPrinterProperty(enum vfiprt::PrtPropertyInt p, int value); // 25 00 00 00
 1178 
 1188  enum vfiprt::PrtError setPrinterProperty(enum vfiprt::PrtPropertyString p, const std::string& value); // 25 00 00 01
 1189 
 1199  enum vfiprt::PrtError getPrinterProperty(enum vfiprt::PrtPropertyInt p, int& value); // 25 01 00 00
 1200 
 1210  enum vfiprt::PrtError getPrinterProperty(enum vfiprt::PrtPropertyString p, std::string& value); // 25 01 00 01
 1211 
 1219  enum vfiprt::PrtError printHtml(const std::string& html, bool landscape = false);
 1220 
 1229  enum vfiprt::PrtError printBitmap(const int width, const int height, const std::vector<unsigned char>& data);
 1230 
 1231 private:
 1232  bool sysPower(unsigned char p2, bool epp);
 1233  bool enableEpp(int& status, unsigned char p2);
 1234 
 1235 }; // class SDI
 1236 
 1237 
 1256 class CardDetection: public SdiCmd
 1257 {
 1258 public:
 1259  const static unsigned char SDI_TEC_CHIP = 1; // ISO 7816
 1260  const static unsigned char SDI_TEC_MAGN = 2; // ISO 7810
 1261  const static unsigned char SDI_TEC_CTLS = 4; // ISO 14443
 1262  const static unsigned char SDI_TEC_MANU = 8; // ITU-T E.161
 1263 
 1268  enum DetectionMode {
 1269  DETECTION_MODE_BLOCKING,
 1270  DETECTION_MODE_POLLING,
 1271  DETECTION_MODE_CALLBACK
 1272  };
 1273 
 1279  void setDetectionMode(const enum DetectionMode mode);
 1280 
 1286  void setTecStartOptions(const std::vector<unsigned char>& opts); // see cts_StartSelection
 1287 
 1293  void setTecConfig(const std::vector<unsigned char>& opts); // see cts_SetOptions
 1294 
 1300  void setCancelButton(bool enable);
 1301 
 1307  void setCardEntryValueDeativation(unsigned char b);
 1308 
 1314  void setAlternativeInputFormat(const char* f);
 1315 
 1326  void setCardRemovalTimeout(unsigned timeout_ms);
 1327 
 1334  void setCallback(void (*cb)(unsigned char technology, void* context), void* ctx);
 1335 
 1336 
 1343  void cardDetectedCallback(unsigned char *dataIn, unsigned short sizeIn);
 1344 
 1345 
 1376  int startSelection(unsigned char supportedTechnologies, unsigned seconds);
 1377 
 1394  enum libsdi::SDI_SW12 stopSelection();
 1395 
 1433  unsigned char receiveTechnology();
 1434 
 1443  bool cardReadAtEpp();
 1444 
 1453  unsigned char pollTechnology();
 1454 
 1462  enum libsdi::SDI_SW12 addTechnology(unsigned char technology, const std::vector<unsigned char>& opts);
 1463 
 1470  enum libsdi::SDI_SW12 removeTechnology(unsigned char technology);
 1471 
 1476  std::string getPan();
 1477 
 1482  std::string getTrack2();
 1483 
 1489  int getTrack2Bin(std::vector<unsigned char>& data);
 1490 
 1495  std::string getCardholderName();
 1496 
 1501  std::string getServiceCode();
 1502 
 1507  std::string getTrack1();
 1508 
 1517  int getPluginResponseData(std::vector<unsigned char>& data);
 1518 
 1532  int getPluginResponseData(unsigned index,
 1533  int32_t& pluginId,
 1534  int32_t& pluginResponseCode,
 1535  std::vector<unsigned char>& data);
 1536 
 1543  bool getPluginResponseData(std::vector<PluginResult>& results);
 1544 
 1551  std::string getString(unsigned CTS_DATA_TAG);
 1552 
 1568  unsigned char getValue(unsigned CTS_DATA_TAG, unsigned char defaultValue);
 1569 
 1577  unsigned char getValue(unsigned CTS_DATA_TAG, int n, unsigned char defaultValue);
 1578 
 1584  int getData(std::vector<unsigned char>& data);
 1585 
 1593  int getData(unsigned CTS_DATA_TAG, std::vector<unsigned char>& data);
 1594 
 1604  int getData(unsigned CTS_DATA_TAG, int n, std::vector<unsigned char>& data);
 1605 
 1614  int getTecselData(std::vector<unsigned char>& data);
 1615 
 1630  int startMsrRead(unsigned timeout_sec);
 1631 
 1643  int msrSetOptions(const std::vector<unsigned char>& opts);
 1644 
 1653  int msrGetTrackStatus(int track);
 1654 
 1661  int msrGetCardSpecificToken(std::vector<unsigned char>& token);
 1662 
 1663  CardDetection();
 1664  ~CardDetection();
 1665 
 1673  virtual void clear();
 1674 
 1675 private:
 1676  void (*callback)(unsigned char technology, void* context);
 1677  void* context;
 1678  enum DetectionMode mode;
 1679 };
 1680 
 1684 class PED: public SdiCmd
 1685 {
 1686 public:
 1690  enum NavigatorMode
 1691  {
 1692  NAVIGATOR_MODE_OFF,
 1693  NAVIGATOR_MODE_DOUBLE_TAB,
 1694  NAVIGATOR_MODE_TACTILE_BUTTON
 1695  };
 1696 
 1705  void setTimeout(unsigned seconds);
 1706 
 1714  bool setDefaultTimeout(unsigned seconds);
 1715 
 1731  void setTouchCoordinates(const unsigned char* array, unsigned size);
 1732 
 1737  void setNavigatorMode(enum NavigatorMode mode);
 1738 
 1749  void setPinDigitCountMinMax(unsigned char min, unsigned char max);
 1750 
 1757  void setLanguage(unsigned char lang);
 1758 
 1765  void setAmount(const unsigned char* amount);
 1766 
 1773  void setCurrency(const unsigned char* currency);
 1774 
 1782  void setAppLabel(const std::string& appLabel);
 1783 
 1810  int startPinInput();
 1811 
 1822  int startPinInput(bool enablePinBypass);
 1823 
 1843  bool startPinEntry(unsigned pinBypassKey = 0);
 1844 
 1851  bool pollPinEntry(std::vector<unsigned char>& status);
 1852 
 1858  bool stopPinEntry();
 1859 
 1868  bool setPinInputClearKeyMode(bool clearAllDigits);
 1869 
 1876  void setClearKeyMode(bool clearAllDigits);
 1877 
 1884  void setPinBypassKeyAndMode(unsigned char value);
 1885 
 1892  void setAutoConfirmation(bool enable);
 1893 
 1900  void setDialogOptions(uint32_t options);
 1901 
 1908  void setIntercharTimeout(uint32_t millis);
 1909 
 1918  void setHeaderLabel(const std::string& label);
 1919 
 1926  void setEchoChar(uint32_t unicode);
 1927 
 1946  bool sendPinInputParameters(bool epp = true);
 1947 
 1954  enum SDI_SW12 receiveGetPinResult();
 1955 
 1964  bool getPinBypassKey(unsigned char& value);
 1965 
 1978  bool enableDualPinEntry();
 1979 
 1990  int validateDualPinEntry();
 1991 };
 1992 
 2001 class SdiCrypt: public SdiBase
 2002 {
 2003 public:
 2004  // SDI Crypto Interface
 2005  SdiCrypt();
 2006  ~SdiCrypt();
 2007 
 2016  bool open(const char* hostName);
 2017 
 2024  bool close();
 2025 
 2031  bool isOpen() const;
 2032 
 2039  uint32_t getCryptoHandle();
 2040 
 2052  bool encrypt(const std::vector<unsigned char>& data,
 2053  std::vector<unsigned char>& encrypted);
 2054 
 2066  bool decrypt(const std::vector<unsigned char>& encrypted,
 2067  std::vector<unsigned char>& decrypted);
 2068 
 2080  bool sign(const std::vector<unsigned char>& data,
 2081  std::vector<unsigned char>& signature);
 2082 
 2094  bool verify(const std::vector<unsigned char>& data,
 2095  const std::vector<unsigned char>& signature);
 2096 
 2111  bool updateKey(unsigned char keyType, const std::vector<unsigned char>& keyData,
 2112  std::vector<unsigned char>* proprietaryData = NULL,
 2113  const unsigned char AS2805 = 0,
 2114  std::vector<unsigned char>* KCV = NULL);
 2115 
 2127  bool setKeySetId(uint32_t ksid, uint32_t mksid = 0, bool asAttribute = false);
 2128 
 2137  bool getEncryptedPin(unsigned char pinBlockFormat,
 2138  std::vector<unsigned char>& pinBlock,
 2139  bool requestZeroPinBlock = false);
 2140 
 2146  std::string getKeyInventory();
 2147 
 2156  bool getKeyData(unsigned char keyType, std::vector<unsigned char>& keyData, unsigned char kekFlag = 0);
 2157 
 2164  std::string getStatus();
 2165 
 2175  std::string getStatus(std::string hostName);
 2176 
 2177 
 2184  static std::string getVersions(int& additionalResult);
 2185 
 2196  void setInitialVector(const std::vector<unsigned char>& iv)
 2197  {
 2198  initialVector = iv;
 2199  }
 2200 
 2206  void getInitialVector(std::vector<unsigned char>& iv) const
 2207  {
 2208  iv = initialVector;
 2209  }
 2210 
 2211 
 2217  void getKeySerialNumber(std::vector<unsigned char>& ksn) const
 2218  {
 2219  ksn = keySerialNumber;
 2220  }
 2221 
 2225  struct Placeholder
 2226  {
 2227  std::vector<unsigned char> tagList;
 2228  std::vector<unsigned char> applicationData;
 2229  std::vector<unsigned char> dataOptions;
 2230  };
 2231 
 2246  bool getEncData(const Placeholder& descriptor,
 2247  std::vector<unsigned char>& encrypted,
 2248  bool useStoredData = false,
 2249  bool incrementKSN = false);
 2250 
 2266  bool getEncMsgData(const std::vector<unsigned char>& messageTemplate,
 2267  const std::vector<Placeholder>& placeholder,
 2268  std::vector<unsigned char>& encrypted,
 2269  bool useStoredData = false,
 2270  bool incrementKSN = false);
 2271 
 2287  bool getMsgSignature(const std::vector<unsigned char>& messageTemplate,
 2288  const std::vector<Placeholder>& placeholder,
 2289  std::vector<unsigned char>& signature,
 2290  bool useStoredData = false,
 2291  bool incrementKSN = false);
 2292 
 2300  bool getEncTrxData(const std::vector<unsigned long> tags, std::vector<unsigned char>& data);
 2301 
 2308  bool setEncTrxData(const std::vector<unsigned char> data);
 2309 
 2315  bool endEncTrxData();
 2316 
 2317 private:
 2318  unsigned char cryptoHandle[4];
 2319  std::vector<unsigned char> initialVector;
 2320  std::vector<unsigned char> keySerialNumber;
 2321  uint32_t keySetId;
 2322  uint32_t masterKeySetId;
 2323 };
 2324 
 2334 class ManualEntry: public SdiCmd
 2335 {
 2336 public:
 2337  ManualEntry();
 2338  ~ManualEntry();
 2339 
 2346  void setLanguage(unsigned char language);
 2347 
 2348 
 2355  int setTimeout(unsigned seconds);
 2356 
 2370  int setCvvEntryDeactivation(unsigned char cvvEntry);
 2371 
 2372 
 2381  int setCardDataEntryMode(unsigned char mode);
 2382 
 2383 
 2390  int setCvvInputString(const std::string &inputString);
 2391 
 2407  int setTouchCoordinates(const unsigned char* array, unsigned size);
 2408 
 2418  int setMimimumDigits(unsigned char minimumDigits);
 2419 
 2429  void setPanDigitLimits(unsigned min, unsigned max = MAX_PAN_DIGITS);
 2430 
 2435  static const unsigned MIN_PAN_DIGITS = 7;
 2436 
 2442  static const unsigned MIN_PAN_DIGITS_DEFAULT = 10;
 2443 
 2447  static const unsigned MAX_PAN_DIGITS = 19;
 2448 
 2457  int setDoubleConfirmationMode(unsigned char mode);
 2458 
 2480  int start();
 2481 
 2498  int receiveResult(std::string& obfuscatedPAN, std::vector<unsigned char>& token);
 2499 
 2508  int getPluginResponseData(std::vector<unsigned char>& data);
 2509 
 2523  int getPluginResponseData(unsigned index,
 2524  int32_t& pluginId,
 2525  int32_t& pluginResponseCode,
 2526  std::vector<unsigned char>& data);
 2527 
 2534  bool getPluginResponseData(std::vector<PluginResult>& results);
 2535 };
 2536 
 2582 class Dialog: public SdiCmd
 2583 {
 2584 public:
 2585 
 2592 
 2598  const static int DIALOG_SUCCESS = 0;
 2599 
 2605  const static int DIALOG_CANCEL_PRESSED = -1;
 2606 
 2612  const static int DIALOG_TIMEOUT = -3;
 2613 
 2620  const static int DIALOG_SYS_ABORT = -8;
 2621 
 2627  const static int DIALOG_CLIENT_ERROR = -14;
 2628 
 2634  const static int DIALOG_SDI_SW12 = -15;
 2635 
 2640  const static int DIALOG_NO_ASYNC_DIALOG = 1;
 2641 
 2646  const static int DIALOG_IN_PROGRESS = 2;
 2647 
 2649 
 2656  const static unsigned DLG_DisplayOnly = 0x00000000;
 2657  const static unsigned DLG_CancelKey = 0x00000002;
 2658  const static unsigned DLG_ClearKey = 0x00000004;
 2659  const static unsigned DLG_EnterKey = 0x00000008;
 2660  const static unsigned DLG_NoLEDs = 0x00000010;
 2661  const static unsigned DLG_CtlsLogo = 0x00000020;
 2662  const static unsigned DLG_QuestionLogo = 0x00000040;
 2663  const static unsigned DLG_WarningLogo = 0x00000080;
 2664  const static unsigned DLG_ErrorLogo = 0x00000100;
 2665  const static unsigned DLG_SuccessLogo = 0x00000200;
 2666  const static unsigned DLG_WaitLogo = 0x00000400;
 2667  const static unsigned DLG_Async = 0x00000800;
 2668  const static unsigned DLG_StoreAsyncResult = 0x00001000;
 2669  const static unsigned DLG_HideSoftKeys = 0x00002000;
 2670  const static unsigned DLG_TextAlignLeft = 0x00004000;
 2671  const static unsigned DLG_TextAlignRight = 0x00008000;
 2672  const static unsigned DLG_TextAlignTop = 0x00010000;
 2673  const static unsigned DLG_TextAlignButton = 0x00020000;
 2674  const static unsigned DLG_NoHeader = 0x00040000;
 2675  const static unsigned DLG_ClearOnReturn = 0x00100000;
 2676  const static unsigned DLG_AbortOnCardRemove = 0x00200000;
 2677  const static unsigned DLG_IgnoreExtAbort = 0x00400000;
 2679 
 2686  const static unsigned MENU_NoOpts = 0x00000000;
 2687  const static unsigned MENU_NoLEDs = 0x00000002;
 2688  const static unsigned MENU_ClearOnReturn = 0x00000004;
 2689  const static unsigned MENU_AbortOnCardRemove= 0x00000008;
 2690  const static unsigned MENU_IgnoreExtAbort = 0x00000010;
 2691  const static unsigned MENU_NoHeader = 0x00000020;
 2693 
 2697  enum REQUEST_CARD_MODE
 2698  {
 2699  REQUEST_CARD_STANDARD = 0,
 2700  REQUEST_CARD_FALLBACK = 1,
 2701  REQUEST_CARD_RETRY = 2
 2702  };
 2703 
 2712  bool clearScreen(bool epp = true);
 2713 
 2737  int display(const std::string& text, bool epp = true);
 2738 
 2762  int secureInput(bool epp = true);
 2763 
 2795  int menu(bool epp = true);
 2796 
 2814  int requestCard(unsigned char technology,
 2815  enum REQUEST_CARD_MODE mode = REQUEST_CARD_STANDARD,
 2816  bool epp = true);
 2817 
 2824  bool idleScreen(bool epp = true);
 2825 
 2841  int captureSignature(std::vector<unsigned char>& signature, std::string& format,
 2842  bool epp = true);
 2843 
 2850  static void showLedArea(bool show);
 2851 
 2873  int htmlDialog(const std::string& fname, bool epp = true);
 2874 
 2886  int getAsyncResult(bool epp = true);
 2887 
 2891  static void abort();
 2892 
 2901  void setTemplate(unsigned char id);
 2902 
 2911  void setInputTemplate(unsigned char id);
 2912 
 2922  void setLanguage(unsigned char language);
 2923 
 2935  void addData(const std::string& name, const std::string& value);
 2936 
 2947  void setTimeout(int seconds);
 2948 
 2961  void setOptions(unsigned options);
 2962 
 2972  void setEnterKeyLabel(const std::string& label);
 2973 
 2983  void setClearKeyLabel(const std::string& label);
 2984 
 2994  void setCancelKeyLabel(const std::string& label);
 2995 
 3005  void setUpKeyLabel(const std::string& label);
 3006 
 3015  void setDownKeyLabel(const std::string& label);
 3016 
 3025  void setHeader(const std::string& text);
 3026 
 3035  void setBeep(bool active = true);
 3036 
 3046  void addAction(const std::string& key, const std::string& action);
 3047 
 3056  void setMaskingCharacter(char c);
 3057 
 3066  void setAlternativeInputFormat(const char* f);
 3067 
 3076  void setAmount(const unsigned char* amount);
 3077 
 3088  void setCurrency(const unsigned char* currency);
 3089 
 3100  void setTransactionType(unsigned char txnType);
 3101 
 3110  void setMenuText(const std::string& text);
 3111 
 3120  void addMenuItem(const std::string& item);
 3121 
 3132  void setPreSelected(unsigned char itemNumber);
 3133 
 3148  void setAdminMenu(unsigned char adminMenu);
 3149 
 3158  unsigned char getSelected();
 3159 
 3169  std::string get(const std::string& name);
 3170 
 3183  std::vector<std::string> getInputFieldNames();
 3184 
 3185 private:
 3186  int startDialog(unsigned char instruction, bool epp);
 3187 };
 3188 
 3189 } // namespace sdi
 3190 
 3191 #ifndef DOXYGEN
 3192 #endif // C++
 3193 #endif
 3194 #endif /* CLIENT_SDI_IF_H_ */
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://sandbox-docs.verifone.com/adk-5.0-programmers-guide/sdi__if_8h_source.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
