{
try {
const ode::DMCryptEngine::data master_key = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F};
+ const std::string master_key_ascii = ode::convertToHex(master_key);
+ // the string master_key_ascii is equal to "000102030405060708090a0b0c0d0e0f" after conversion
+
ode::DMCryptEngine::data answer = {0x30, 0x30, 0x30, 0x31, 0x30, 0x32, 0x30, 0x33, 0x30, 0x34, 0x30, 0x35, 0x30, 0x36, 0x30, 0x37,
- 0x30, 0x38, 0x30, 0x39, 0x30, 0x41, 0x30, 0x42, 0x30, 0x43, 0x30, 0x44, 0x30, 0x45, 0x30, 0x46
+ 0x30, 0x38, 0x30, 0x39, 0x30, 0x61, 0x30, 0x62, 0x30, 0x63, 0x30, 0x64, 0x30, 0x65, 0x30, 0x66
};
- const std::string master_key_ascii = ode::convertToHex(master_key);
+ // the answer is a set of hex codes of ASCII symbols in master_key_ascii string, e.g. hex(a) = 0x61
// check
for (unsigned int i = 0; i < master_key.size() * 2; i++) {
{
try {
const ode::DMCryptEngine::data master_key = {0xF0, 0xE1, 0xD2, 0xC3, 0xB4, 0xA5, 0x96, 0x87, 0x78, 0x69, 0x5A, 0x4B, 0x3C, 0x2D, 0x1E, 0x0F};
- ode::DMCryptEngine::data answer = {0x46, 0x30, 0x45, 0x31, 0x44, 0x32, 0x43, 0x33, 0x42, 0x34, 0x41, 0x35, 0x39, 0x36, 0x38, 0x37,
- 0x37, 0x38, 0x36, 0x39, 0x35, 0x41, 0x34, 0x42, 0x33, 0x43, 0x32, 0x44, 0x31, 0x45, 0x30, 0x46
- };
const std::string master_key_ascii = ode::convertToHex(master_key);
+ // the string master_key_ascii is equal to "f0e1d2c3b4a5968778695a4b3c2d1e0f" after conversion
+
+ ode::DMCryptEngine::data answer = {0x66, 0x30, 0x65, 0x31, 0x64, 0x32, 0x63, 0x33, 0x62, 0x34, 0x61, 0x35, 0x39, 0x36, 0x38, 0x37,
+ 0x37, 0x38, 0x36, 0x39, 0x35, 0x61, 0x34, 0x62, 0x33, 0x63, 0x32, 0x64, 0x31, 0x65, 0x30, 0x66
+ };
+ // the answer is a set of hex codes of ASCII symbols in master_key_ascii string, e.g. hex(a) = 0x61
// check
for (unsigned int i = 0; i < master_key.size() * 2; i++)
// -- expected: cause exception
{
const std::string keystring = "SMALLER_THAN_32BYTES______";
- const ode::DMCryptEngine::data keySmall32bit(keystring.begin(), keystring.end());
+ const ode::DMCryptEngine::data shortKey(keystring.begin(), keystring.end());
try {
- ode::sanitizeKey(keySmall32bit);
- //
- TEST_FAIL("small key should be cause exception");
+ ode::sanitizeKey(shortKey);
+ TEST_FAIL("small key should cause an exception");
} catch (runtime::Exception &e) {
// expected result: it's good
}