Skip to main content
better title
Link
Alex Spataru
  • 1.3k
  • 2
  • 8
  • 10

How can I protect an API token & shared secret withsensitive information inside a C++ binary?

Source Link
Alex Spataru
  • 1.3k
  • 2
  • 8
  • 10

How can I protect an API token & shared secret with a C++ binary

I am currently developing an application with Qt/C++ which needs to access a Shopify store using the Admin API. In order to access the API, my application needs to know the following information:

  • API Token
  • Shared Secret
  • API Password

These values are stored as strings in a header using a simple #define, for example:

#ifndef STORE_INFO_H
#define STORE_INFO_H

#define ADMIN_API_TOKEN         "..."
#define ADMIN_API_PASSWORD      "..."
#define ADMIN_API_SHARED_SECRET "..."

// Sha la la la

#endif

Afterwards, these values are used across the application as needed. However, there's one big issue with this approach: if someone is smart enough to open the binary application inside a HEX editor or a decompiler, he or she may be able to see this information (which, if used with malicious purposes, could do a lot of damage).

Irrelevant of the needs of my application or which API I am using, is there are way to "hide" or protect sensitive information constants in a C/C++ application?