implementing 3 dimensional array (or other technique)
Hi all -
This is strictly a coding exercise, with the goal being clarity and ease of use.
The app I'm working on uses a TLS-esque credential technique. A credential set consists of (all binary):
- 32-byte authentication key
- 32-byte encryption key
- 100-byte username
- 100-byte passphrase
There are 3 levels of credentials: manufacturing, application, and operational.
The application must support a small number of customers, each with their own credentials.
My first thought was to create a structure to hold the 4 arrays needed above (using QByteArray), and have a two-dimensional vector of these structures. But, as multidimensional vectors, whether in C++ or Qt, tend to get cumbersome to code. Also, it's probably good practice not to distribute one customer's authentication data to another customer, even though it's well hidden in the binary file.
I guess another way to do this would be to furnish a plugin that supplied the credential set for the customer in question. This would eliminate the need for the application to contain credentials for multiple customers. Or is this overkill?
I appreciate any feedback.
Also, it's probably good practice not to distribute one customer's authentication data to another customer, even though it's well hidden in the binary file.
Really? Unless you take special care to obfuscate your data you may safely assume it is passed as a clear text.
Just read data from file (maybe rcc binary resource file; data may be encrypted if it makes you feel safer, but actually it's nothing more than obfuscation), and attach unique file to each customer's copy
@Konstantin-Tokarev if I use a resource file, don't I have to re-build the binary whenever I change which customer's file I want to use?
@mzimmers Yes, you don't have to