Refactor RawBuffer hex dumps
[platform/core/security/key-manager.git] / src / manager / dpl / db / src / sql_connection.cpp
index 902c94d..15e3cc8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2014-2019 Samsung Electronics Co., Ltd. All rights reserved
  *
  *    Licensed under the Apache License, Version 2.0 (the "License");
  *    you may not use this file except in compliance with the License.
@@ -678,16 +678,7 @@ const std::size_t SQLCIPHER_RAW_DATA_SIZE = 32;
 
 RawBuffer rawToHexString(const RawBuffer &raw)
 {
-       RawBuffer output;
-
-       for (auto &e : raw) {
-               char result[3];
-               snprintf(result, sizeof(result), "%02X", (e & 0xff));
-               output.push_back(static_cast<unsigned char>(result[0]));
-               output.push_back(static_cast<unsigned char>(result[1]));
-       }
-
-       return output;
+       return hexDump<RawBuffer, true>(raw);
 }
 
 RawBuffer createHexPass(const RawBuffer &rawPass)