Add upgrade script
[platform/core/security/drm-service-core-tizen.git] / test / drm_testapps.cpp
index d81f32f..07c2194 100644 (file)
  * limitations under the License.
  */
 
+#include <vector>
+#include <fstream>
+#include <iostream>
+
 #include "drm-tizen-apps.h"
 #include "drm-tizen-error.h"
 #include "TADC_Core.h"
@@ -22,7 +26,7 @@
 
 #include "DTapps2Rights.h"
 #include "drm_testutil.h"
-#include <tzplatform_config.h>
+#include "drm_testcore.h"
 
 #if 1
 static int first_key = 0;
@@ -32,13 +36,13 @@ static int third_key = 0;
 bool _write_logfile(const char *filename, char *buf, unsigned int len)
 {
        FILE *fd = NULL;
-       
+
        if ((fd = fopen(filename,"w+b")) == NULL)
        {
                return false;
        }
 
-       fwrite(buf, 1, len,fd); 
+       fwrite(buf, 1, len,fd);
        fclose(fd);
 
        return true;
@@ -48,13 +52,13 @@ bool _read_logfile(const char *filename, char *buf, unsigned int *pLen)
 {
        FILE *fd = NULL;
        int  nReadLen = 0;
-       
+
        if ((fd = fopen(filename,"r+b")) == NULL)
        {
                return false;
        }
 
-       nReadLen = fread(buf, 1, *pLen,fd); 
+       nReadLen = fread(buf, 1, *pLen,fd);
        *pLen = nReadLen;
 
        fclose(fd);
@@ -64,587 +68,178 @@ bool _read_logfile(const char *filename, char *buf, unsigned int *pLen)
 
 bool tc01_VerifyRoSignature_Positive_01(void)
 {
-       char Buf[1024*10] = {0, };      
-       const char *pRo = tzplatform_mkpath(TZ_SYS_DATA,"drm_test/RO/38EIfBurLJ-1.0.2.ro");
-
-       FILE *fd = NULL;
-       int     nReadLen = 0;
-       long lSize = 0;
-       int nRet = 0;
-
        printf("tc01_VerifyRoSignature_Positive_01() -------- Started! \n");
 
-       fd = fopen(pRo, "rb");
-       if (fd == NULL)
-       {
-               printf("File is not exist! : %s\n", pRo);
-               goto CATCH;
-       }
+       const char *pRo = TEST_DATA_DIR "/RO/38EIfBurLJ-1.0.2.ro";
 
-       fseek(fd, 0, SEEK_END);
-       lSize = ftell(fd);
-       if (lSize < 0)
-       {
-               printf("fseek() and ftell() failed.");
-               goto CATCH;
-       }
-       rewind(fd);
-
-       memset(Buf, 0x00, sizeof(Buf));
-       nReadLen = fread(Buf, 1, lSize, fd);
-       if (nReadLen >= sizeof(Buf))
-       {
-               printf("Buffer error! : %s\n", pRo);
-               goto CATCH;
-       }
+       auto buf = _read_ro_file(pRo);
 
-       if (nReadLen != lSize)
-       {
-               printf("File read error! : %s\n", pRo);
-               goto CATCH;
-       }
-
-       nRet = TADC_VerifyROSignature((unsigned char*) Buf);
-       if (nRet != 0)
-       {
+       int nRet = TADC_VerifyROSignature(buf.data());
+       if (nRet != 0) {
                printf("VerifyROSignature Failed! : %s, %d\n", pRo, nRet);
-               goto CATCH;
-       }
-       if (fd != NULL)
-       {
-               fclose(fd);
+               return false;
        }
 
        printf("tc01_VerifyRoSignature_Positive_01() finished! -------- success \n");
-       return true;
 
-CATCH:
-       if (fd != NULL)
-       {
-               fclose(fd);
-       }
-       return false;
+       return true;
 }
 
 bool tc01_VerifyRoSignature_Positive_02(void)
 {
-       char Buf[1024*10] = {0, };      
-       const char *pRo = tzplatform_mkpath(TZ_SYS_DATA,"drm_test/RO/8SPXfqc6iL-1.0.0.ro");
-
-       FILE *fd = NULL;
-       int     nReadLen = 0;
-       long lSize = 0;
-       int nRet = 0;
-
        printf("tc01_VerifyRoSignature_Positive_02() -------- Started! \n");
+       const char *pRo = TEST_DATA_DIR "/RO/8SPXfqc6iL-1.0.0.ro";
 
-       fd = fopen(pRo, "rb");
-       if (fd == NULL)
-       {
-               printf("File is not exist! : %s\n", pRo);
-               goto CATCH;
-       }
-
-       fseek(fd, 0, SEEK_END);
-       lSize = ftell(fd);
-       if (lSize < 0)
-       {
-               printf("fseek() and ftell() failed.");
-               goto CATCH;
-       }
-       rewind(fd);
-
-       memset(Buf, 0x00, sizeof(Buf));
-       nReadLen = fread(Buf, 1, lSize, fd);
-       if (nReadLen >= sizeof(Buf))
-       {
-               printf("Buffer error! : %s\n", pRo);
-               goto CATCH;
-       }
-
-       if (nReadLen != lSize)
-       {
-               printf("File read error! : %s\n", pRo);
-               goto CATCH;
-       }
+       auto buf = _read_ro_file(pRo);
 
-       nRet = TADC_VerifyROSignature((unsigned char*) Buf);
-       if (nRet != 0)
-       {
+       int nRet = TADC_VerifyROSignature(buf.data());
+       if (nRet != 0) {
                printf("VerifyROSignature Failed! : %s, %d\n", pRo, nRet);
-               goto CATCH;
-       }
-       if (fd != NULL)
-       {
-               fclose(fd);
+               return false;
        }
 
        printf("tc01_VerifyRoSignature_Positive_02() finished! -------- success \n");
        return true;
-
-CATCH:
-       if (fd != NULL)
-       {
-               fclose(fd);
-       }
-       return false;
 }
 
 bool tc01_VerifyRoSignature_Positive_03(void)
 {
-       char Buf[1024*10] = {0, };      
-       const char *pRo = tzplatform_mkpath(TZ_SYS_DATA,"drm_test/RO/FightGuiIF-1.0.0.ro");
-
-       FILE *fd = NULL;
-       int     nReadLen = 0;
-       long lSize = 0;
-       int nRet = 0;
-
        printf("tc01_VerifyRoSignature_Positive_03() -------- Started! \n");
 
-       fd = fopen(pRo, "rb");
-       if (fd == NULL)
-       {
-               printf("File is not exist! : %s\n", pRo);
-               goto CATCH;
-       }
-
-       fseek(fd, 0, SEEK_END);
-       lSize = ftell(fd);
-       if (lSize < 0)
-       {
-               printf("fseek() and ftell() failed.");
-               goto CATCH;
-       }
-       rewind(fd);
+       const char *pRo = TEST_DATA_DIR "/RO/FightGuiIF-1.0.0.ro";
 
-       memset(Buf, 0x00, sizeof(Buf));
-       nReadLen = fread(Buf, 1, lSize, fd);
-       if (nReadLen >= sizeof(Buf))
-       {
-               printf("Buffer error! : %s\n", pRo);
-               goto CATCH;
-       }
-
-       if (nReadLen != lSize)
-       {
-               printf("File read error! : %s\n", pRo);
-               goto CATCH;
-       }
+       auto buf = _read_ro_file(pRo);
 
-       nRet = TADC_VerifyROSignature((unsigned char*) Buf);
+       int nRet = TADC_VerifyROSignature(buf.data());
        if (nRet != 0)
        {
                printf("VerifyROSignature Failed! : %s, %d\n", pRo, nRet);
-               goto CATCH;
-       }
-       if (fd != NULL)
-       {
-               fclose(fd);
+               return false;
        }
 
        printf("tc01_VerifyRoSignature_Positive_03() finished! -------- success \n");
        return true;
-
-CATCH:
-       if (fd != NULL)
-       {
-               fclose(fd);
-       }
-       return false;
 }
 
 bool tc02_VerifyRoSignature_Negative_Cert_01(void)
 {
-       char Buf[1024*10] = {0, };      
-       const char *pRo  = tzplatform_mkpath(TZ_SYS_DATA,"drm_test/RO/38EIfBurLJ-1.0.2.cert_only_selfsigned.ro");
-       FILE *fd = NULL;
-       int     nReadLen = 0;
-       long lSize = 0;
-       int nRet = 0;
-
        printf("tc02_VerifyRoSignature_Negative_Cert_01() -------- Started! \n");
 
-       fd = fopen(pRo, "rb");
-       if (fd == NULL)
-       {
-               printf("File is not exist! : %s\n", pRo);
-               goto CATCH;
-       }
+       const char *pRo  = TEST_DATA_DIR "/RO/38EIfBurLJ-1.0.2.cert_only_selfsigned.ro";
 
-       fseek(fd, 0, SEEK_END);
-       lSize = ftell(fd);
-       if (lSize < 0)
-       {
-               printf("fseek() and ftell() failed.");
-               goto CATCH;
-       }
-       rewind(fd);
+       auto buf = _read_ro_file(pRo);
 
-       memset(Buf, 0x00, sizeof(Buf));
-       nReadLen = fread(Buf, 1, lSize, fd);
-       if (nReadLen >= sizeof(Buf))
-       {
-               printf("Buffer error! : %s\n", pRo);
-               goto CATCH;
-       }
-
-       if (nReadLen != lSize)
-       {
-               printf("File read error! : %s\n", pRo);
-               goto CATCH;
-       }
-
-       nRet = TADC_VerifyROSignature((unsigned char*) Buf);
-       if (nRet >= 0)
-       {
+       int nRet = TADC_VerifyROSignature(buf.data());
+       if (nRet >= 0) {
                printf("VerifyROSignature have to be failed. But success! : %s, %d\n", pRo, nRet);
-               goto CATCH;
-       }
-       if (fd != NULL)
-       {
-               fclose(fd);
+               return false;
        }
 
        printf("tc02_VerifyRoSignature_Negative_Cert_01 finished! -------- success \n");
        return true;
-
-CATCH:
-       if (fd != NULL)
-       {
-               fclose(fd);
-       }
-       return false;
 }
 
 bool tc02_VerifyRoSignature_Negative_Cert_02(void)
 {
-       char Buf[1024*10] = {0, };      
-       const char *pRo = tzplatform_mkpath(TZ_SYS_DATA,"drm_test/RO/38EIfBurLJ-1.0.2.cert_chain_invalid.ro");
-       FILE *fd = NULL;
-       int     nReadLen = 0;
-       long lSize = 0;
-       int nRet = 0;
-
        printf("tc02_VerifyRoSignature_Negative_Cert_02() -------- Started! \n");
 
-       fd = fopen(pRo, "rb");
-       if (fd == NULL)
-       {
-               printf("File is not exist! : %s\n", pRo);
-               goto CATCH;
-       }
-
-       fseek(fd, 0, SEEK_END);
-       lSize = ftell(fd);
-       if (lSize < 0)
-       {
-               printf("fseek() and ftell() failed.");
-               goto CATCH;
-       }
-       rewind(fd);
+       const char *pRo = TEST_DATA_DIR "/RO/38EIfBurLJ-1.0.2.cert_chain_invalid.ro";
 
-       memset(Buf, 0x00, sizeof(Buf));
-       nReadLen = fread(Buf, 1, lSize, fd);
-       if (nReadLen >= sizeof(Buf))
-       {
-               printf("Buffer error! : %s\n", pRo);
-               goto CATCH;
-       }
+       auto buf = _read_ro_file(pRo);
 
-       if (nReadLen != lSize)
-       {
-               printf("File read error! : %s\n", pRo);
-               goto CATCH;
-       }
-
-       nRet = TADC_VerifyROSignature((unsigned char*) Buf);
-       if (nRet >= 0)
-       {
+       int nRet = TADC_VerifyROSignature(buf.data());
+       if (nRet >= 0) {
                printf("VerifyROSignature have to be failed. But success! : %s, %d\n", pRo, nRet);
-               goto CATCH;
-       }
-       if (fd != NULL)
-       {
-               fclose(fd);
+               return false;
        }
 
        printf("tc02_VerifyRoSignature_Negative_Cert_02 finished! -------- success \n");
        return true;
-
-CATCH:
-       if (fd != NULL)
-       {
-               fclose(fd);
-       }
-       return false;
 }
 
 bool tc02_VerifyRoSignature_Negative_Cert_03(void)
 {
-       char Buf[1024*10] = {0, };      
-       const char *pRo  = tzplatform_mkpath(TZ_SYS_DATA,"drm_test/RO/38EIfBurLJ-1.0.2.cert_invalid.ro");
-       FILE *fd = NULL;
-       int     nReadLen = 0;
-       long lSize = 0;
-       int nRet = 0;
-
        printf("tc02_VerifyRoSignature_Negative_Cert_03() -------- Started! \n");
 
-       fd = fopen(pRo, "rb");
-       if (fd == NULL)
-       {
-               printf("File is not exist! : %s\n", pRo);
-               goto CATCH;
-       }
-
-       fseek(fd, 0, SEEK_END);
-       lSize = ftell(fd);
-       if (lSize < 0)
-       {
-               printf("fseek() and ftell() failed.");
-               goto CATCH;
-       }
-       rewind(fd);
-
-       memset(Buf, 0x00, sizeof(Buf));
-       nReadLen = fread(Buf, 1, lSize, fd);
-       if (nReadLen >= sizeof(Buf))
-       {
-               printf("Buffer error! : %s\n", pRo);
-               goto CATCH;
-       }
+       const char *pRo  = TEST_DATA_DIR "/RO/38EIfBurLJ-1.0.2.cert_invalid.ro";
 
-       if (nReadLen != lSize)
-       {
-               printf("File read error! : %s\n", pRo);
-               goto CATCH;
-       }
+       auto buf = _read_ro_file(pRo);
 
-       nRet = TADC_VerifyROSignature((unsigned char*) Buf);
-       if (nRet >= 0)
-       {
+       int nRet = TADC_VerifyROSignature(buf.data());
+       if (nRet >= 0) {
                printf("VerifyROSignature have to be failed. But success! : %s, %d\n", pRo, nRet);
-               goto CATCH;
-       }
-       if (fd != NULL)
-       {
-               fclose(fd);
+               return false;
        }
 
        printf("tc02_VerifyRoSignature_Negative_Cert_03 finished! -------- success \n");
        return true;
-
-CATCH:
-       if (fd != NULL)
-       {
-               fclose(fd);
-       }
-       return false;
 }
 
 bool tc03_VerifyRoSignature_Negative_Signature_01(void)
 {
-       char Buf[1024*10] = {0, };      
-       const char *pRo   = tzplatform_mkpath(TZ_SYS_DATA,"drm_test/RO/FightGuiIF-1.0.0.signature_invalid.ro");
-       FILE *fd = NULL;
-       int     nReadLen = 0;
-       long lSize = 0;
-       int nRet = 0;
-
        printf("tc03_VerifyRoSignature_Negative_Signature_01() -------- Started! \n");
 
-       fd = fopen(pRo, "rb");
-       if (fd == NULL)
-       {
-               printf("File is not exist! : %s\n", pRo);
-               goto CATCH;
-       }
-
-       fseek(fd, 0, SEEK_END);
-       lSize = ftell(fd);
-       if (lSize < 0)
-       {
-               printf("fseek() and ftell() failed.");
-               goto CATCH;
-       }
-       rewind(fd);
-
-       memset(Buf, 0x00, sizeof(Buf));
-       nReadLen = fread(Buf, 1, lSize, fd);
-       if (nReadLen >= sizeof(Buf))
-       {
-               printf("Buffer error! : %s\n", pRo);
-               goto CATCH;
-       }
+       const char *pRo   = TEST_DATA_DIR "/RO/FightGuiIF-1.0.0.signature_invalid.ro";
 
-       if (nReadLen != lSize)
-       {
-               printf("File read error! : %s\n", pRo);
-               goto CATCH;
-       }
+       auto buf = _read_ro_file(pRo);
 
-       nRet = TADC_VerifyROSignature((unsigned char*) Buf);
-       if (nRet >= 0)
-       {
+       int nRet = TADC_VerifyROSignature(buf.data());
+       if (nRet >= 0) {
                printf("VerifyROSignature have to be failed. But success! : %s, %d\n", pRo, nRet);
-               goto CATCH;
-       }
-       if (fd != NULL)
-       {
-               fclose(fd);
+               return false;
        }
 
        printf("tc03_VerifyRoSignature_Negative_Signature_01() finished! -------- success \n");
 
        return true;
-
-CATCH:
-       if (fd != NULL)
-       {
-               fclose(fd);
-       }
-       return false;
 }
 
 bool tc03_VerifyRoSignature_Negative_Signature_02(void)
 {
-       char Buf[1024*10] = {0, };      
-       const char *pRo = tzplatform_mkpath(TZ_SYS_DATA,"drm_test/RO/38EIfBurLJ-1.0.2.signature_invalid.ro");
-       FILE *fd = NULL;
-       int     nReadLen = 0;
-       long lSize = 0;
-       int nRet = 0;
-
        printf("tc03_VerifyRoSignature_Negative_Signature_02() -------- Started! \n");
 
-       fd = fopen(pRo, "rb");
-       if (fd == NULL)
-       {
-               printf("File is not exist! : %s\n", pRo);
-               goto CATCH;
-       }
-
-       fseek(fd, 0, SEEK_END);
-       lSize = ftell(fd);
-       if (lSize < 0)
-       {
-               printf("fseek() and ftell() failed.");
-               goto CATCH;
-       }
-       rewind(fd);
+       const char *pRo = TEST_DATA_DIR "/RO/38EIfBurLJ-1.0.2.signature_invalid.ro";
 
-       memset(Buf, 0x00, sizeof(Buf));
-       nReadLen = fread(Buf, 1, lSize, fd);
-       if (nReadLen >= sizeof(Buf))
-       {
-               printf("Buffer error! : %s\n", pRo);
-               goto CATCH;
-       }
-
-       if (nReadLen != lSize)
-       {
-               printf("File read error! : %s\n", pRo);
-               goto CATCH;
-       }
+       auto buf = _read_ro_file(pRo);
 
-       nRet = TADC_VerifyROSignature((unsigned char*) Buf);
-       if (nRet >= 0)
-       {
+       int nRet = TADC_VerifyROSignature(buf.data());
+       if (nRet >= 0) {
                printf("VerifyROSignature have to be failed. But success! : %s, %d\n", pRo, nRet);
-               goto CATCH;
-       }
-       if (fd != NULL)
-       {
-               fclose(fd);
+               return false;
        }
 
        printf("tc03_VerifyRoSignature_Negative_Signature_01() finished! -------- success \n");
 
        return true;
-
-CATCH:
-       if (fd != NULL)
-       {
-               fclose(fd);
-       }
-       return false;
 }
 
 bool tc03_VerifyRoSignature_Negative_Signature_03(void)
 {
-       char Buf[1024*10] = {0, };      
-       const char *pRo  = tzplatform_mkpath(TZ_SYS_DATA,"drm_test/RO/8SPXfqc6iL-1.0.0.signature_invalid.ro");
-       FILE *fd = NULL;
-       int     nReadLen = 0;
-       long lSize = 0;
-       int nRet = 0;
-
        printf("tc03_VerifyRoSignature_Negative_Signature_03() -------- Started! \n");
 
-       fd = fopen(pRo, "rb");
-       if (fd == NULL)
-       {
-               printf("File is not exist! : %s\n", pRo);
-               goto CATCH;
-       }
+       const char *pRo  = TEST_DATA_DIR "/RO/8SPXfqc6iL-1.0.0.signature_invalid.ro";
 
-       fseek(fd, 0, SEEK_END);
-       lSize = ftell(fd);
-       if (lSize < 0)
-       {
-               printf("fseek() and ftell() failed.");
-               goto CATCH;
-       }
-       rewind(fd);
+       auto buf = _read_ro_file(pRo);
 
-       memset(Buf, 0x00, sizeof(Buf));
-       nReadLen = fread(Buf, 1, lSize, fd);
-       if (nReadLen >= sizeof(Buf))
-       {
-               printf("Buffer error! : %s\n", pRo);
-               goto CATCH;
-       }
-
-       if (nReadLen != lSize)
-       {
-               printf("File read error! : %s\n", pRo);
-               goto CATCH;
-       }
-
-       nRet = TADC_VerifyROSignature((unsigned char*) Buf);
-       if (nRet >= 0)
-       {
+       int nRet = TADC_VerifyROSignature(buf.data());
+       if (nRet >= 0) {
                printf("VerifyROSignature have to be failed. But success! : %s, %d\n", pRo, nRet);
-               goto CATCH;
-       }
-       if (fd != NULL)
-       {
-               fclose(fd);
+               return false;
        }
 
        printf("tc03_VerifyRoSignature_Negative_Signature_03() finished! -------- success \n");
 
        return true;
-
-CATCH:
-       if (fd != NULL)
-       {
-               fclose(fd);
-       }
-       return false;
 }
 
 bool tc04_isDrmFile_Positive_01(void)
 {
-       const char *pDCF = tzplatform_mkpath(TZ_SYS_DATA,"drm_test/DCF/38EIfBurLJ.tpk");
-       int nRet = 0;
+       const char *pDCF = TEST_DATA_DIR "/DCF/38EIfBurLJ.tpk";
 
        printf("tc04_isDrmFile_Positive_01() -------- Started!\n");
 
-       nRet = drm_tizen_is_drm_file(pDCF, strlen(pDCF));
-       if (nRet != TADC_SUCCESS)
-       {
+       int nRet = drm_tizen_is_drm_file(pDCF, strlen(pDCF));
+       if (nRet != TADC_SUCCESS) {
                printf("drm_tizen_is_drm_file failed. Path = %s, Ret = %d\n", pDCF,  nRet);
                printf("%s file is not TADC file!\n", pDCF);
                return false;
@@ -657,14 +252,12 @@ bool tc04_isDrmFile_Positive_01(void)
 
 bool tc04_isDrmFile_Positive_02(void)
 {
-       const char *pDCF = tzplatform_mkpath(TZ_SYS_DATA,"drm_test/DCF/8SPXfqc6iL.tpk");
-       int nRet = 0;
+       const char *pDCF = TEST_DATA_DIR "/DCF/8SPXfqc6iL.tpk";
 
        printf("tc04_isDrmFile_Positive_02() -------- Started!\n");
 
-       nRet = drm_tizen_is_drm_file(pDCF, strlen(pDCF));
-       if (nRet != TADC_SUCCESS)
-       {
+       int nRet = drm_tizen_is_drm_file(pDCF, strlen(pDCF));
+       if (nRet != TADC_SUCCESS) {
                printf("drm_tizen_is_drm_file failed. Path = %s, Ret = %d\n", pDCF,  nRet);
                printf("%s file is not TADC file!\n", pDCF);
                return false;
@@ -677,14 +270,12 @@ bool tc04_isDrmFile_Positive_02(void)
 
 bool tc04_isDrmFile_Positive_03(void)
 {
-       const char *pDCF = tzplatform_mkpath(TZ_SYS_DATA,"drm_test/DCF/FightGuiIF.tpk");
-       int nRet = 0;
+       const char *pDCF = TEST_DATA_DIR "/DCF/FightGuiIF.tpk";
 
        printf("tc04_isDrmFile_Positive_03() -------- Started!\n");
 
-       nRet = drm_tizen_is_drm_file(pDCF, strlen(pDCF));
-       if (nRet != TADC_SUCCESS)
-       {
+       int nRet = drm_tizen_is_drm_file(pDCF, strlen(pDCF));
+       if (nRet != TADC_SUCCESS) {
                printf("drm_tizen_is_drm_file failed. Path = %s, Ret = %d\n", pDCF,  nRet);
                printf("%s file is not TADC file!\n", pDCF);
                return false;
@@ -697,14 +288,12 @@ bool tc04_isDrmFile_Positive_03(void)
 
 bool tc05_isDrmFile_Negative_01(void)
 {
-       const char *pApp = tzplatform_mkpath(TZ_SYS_DATA,"drm_test/DecryptedApp/38EIfBurLJ_dec.tpk");
-       int nRet = 0;
+       const char *pApp = TEST_DATA_DIR "/DecryptedApp/38EIfBurLJ_dec.tpk";
 
        printf("tc05_isDrmFile_Negative_01() -------- Started! \n");
 
-       nRet = drm_tizen_is_drm_file(pApp, strlen(pApp));
-       if(nRet == TADC_SUCCESS)
-       {
+       int nRet = drm_tizen_is_drm_file(pApp, strlen(pApp));
+       if(nRet == TADC_SUCCESS) {
                printf("drm_tizen_is_drm_file have to be failed. But Success!  Path = %s, Ret = %d\n", pApp,  nRet);
                return false;
        }
@@ -716,14 +305,12 @@ bool tc05_isDrmFile_Negative_01(void)
 
 bool tc05_isDrmFile_Negative_02(void)
 {
-       const char *pApp = tzplatform_mkpath(TZ_SYS_DATA,"drm_test/DecryptedApp/8SPXfqc6iL_dec.tpk");
-       int nRet = 0;
+       const char *pApp = TEST_DATA_DIR "/DecryptedApp/8SPXfqc6iL_dec.tpk";
 
        printf("tc05_isDrmFile_Negative_02() -------- Started! \n");
 
-       nRet = drm_tizen_is_drm_file(pApp, strlen(pApp));
-       if(nRet == TADC_SUCCESS)
-       {
+       int nRet = drm_tizen_is_drm_file(pApp, strlen(pApp));
+       if(nRet == TADC_SUCCESS) {
                printf("drm_tizen_is_drm_file have to be failed. But Success!  Path = %s, Ret = %d\n", pApp,  nRet);
                return false;
        }
@@ -735,14 +322,12 @@ bool tc05_isDrmFile_Negative_02(void)
 
 bool tc05_isDrmFile_Negative_03(void)
 {
-       const char *pApp = tzplatform_mkpath(TZ_SYS_DATA,"drm_test/DecryptedApp/FightGuiIF_dec.tpk");
-       int nRet = 0;
+       const char *pApp = TEST_DATA_DIR "/DecryptedApp/FightGuiIF_dec.tpk";
 
        printf("tc05_isDrmFile_Negative_03() -------- Started! \n");
 
-       nRet = drm_tizen_is_drm_file(pApp, strlen(pApp));
-       if(nRet == TADC_SUCCESS)
-       {
+       int nRet = drm_tizen_is_drm_file(pApp, strlen(pApp));
+       if(nRet == TADC_SUCCESS) {
                printf("drm_tizen_is_drm_file have to be failed. But Success!  Path = %s, Ret = %d\n", pApp,  nRet);
                return false;
        }
@@ -755,7 +340,7 @@ bool tc05_isDrmFile_Negative_03(void)
 bool
 tc06_DrmFileHandlerPositive_01(void)
 {
-       const char *pDCF = tzplatform_mkpath(TZ_SYS_DATA,"drm_test/DCF/38EIfBurLJ.tpk");
+       const char *pDCF = TEST_DATA_DIR "/DCF/38EIfBurLJ.tpk";
        DrmFileHandler* pDcfHandler = NULL;
        unsigned char* pBufCEK = NULL;
        unsigned char pCEK[CEK_SIZE + 1] = {0xB1, 0x03, 0x4F, 0x30, 0xC8, 0x52, 0x45, 0x7E, 0x9D, 0xA2, 0x52, 0x25, 0x2E, 0xA9, 0x9B, 0x2B, 0x25, 0x36, 0xF1, 0x8D, 0x04, 0xD1, 0x4C, 0xE3, 0x96, 0x81, 0xD9, 0x98, 0xBB, 0xD7, 0x7E, 0xCA, 0x00};
@@ -858,7 +443,7 @@ CATCH:
 bool
 tc06_DrmFileHandlerPositive_02(void)
 {
-       const char *pDCF = tzplatform_mkpath(TZ_SYS_DATA,"drm_test/DCF/8SPXfqc6iL.tpk");
+       const char *pDCF = TEST_DATA_DIR "/DCF/8SPXfqc6iL.tpk";
        unsigned char* pBufCEK = NULL;
        DrmFileHandler* pDcfHandler = NULL;
        unsigned char pCEK[CEK_SIZE + 1] = {0xBB, 0x87, 0x5D, 0xA8, 0x2C, 0xC4, 0x47, 0x81, 0x90, 0xBA, 0xD9, 0xB0, 0x0C, 0xD2, 0x94, 0xE9, 0x19, 0x0F, 0x24, 0x62, 0x5B, 0x0B, 0x49, 0x7A, 0xAE, 0x8E, 0x1D, 0x88, 0x7F, 0xF9, 0x96, 0xDB, 0x00};
@@ -961,7 +546,7 @@ CATCH:
 bool
 tc06_DrmFileHandlerPositive_03(void)
 {
-       const char *pDCF = tzplatform_mkpath(TZ_SYS_DATA,"drm_test/DCF/FightGuiIF.tpk");
+       const char *pDCF = TEST_DATA_DIR "/DCF/FightGuiIF.tpk";
        unsigned char* pBufCEK = NULL;
        DrmFileHandler* pDcfHandler = NULL;
        unsigned char pCEK[CEK_SIZE + 1] = {0x34, 0x5A, 0x94, 0x28, 0xC3, 0xF4, 0x44, 0x3F, 0x86, 0x6D, 0xCF, 0xC5, 0x78, 0x1F, 0x23, 0xCE, 0xE9, 0x9B, 0xC4, 0x45, 0xA3, 0x30, 0x47, 0x1E, 0xB4, 0xE0, 0xAF, 0x96, 0x0F, 0xDE, 0xA9, 0xB4, 0x00};
@@ -1063,7 +648,7 @@ CATCH:
 
 bool tc07_DrmFileMgrPositive_01(void)
 {
-       const char *pDCF = tzplatform_mkpath(TZ_SYS_DATA,"drm_test/DCF/38EIfBurLJ.tpk");
+       const char *pDCF = TEST_DATA_DIR "/DCF/38EIfBurLJ.tpk";
        int nRet = TADC_SUCCESS;
 
        DrmFileMgr* pDrmFileMgr = NULL;
@@ -1081,7 +666,7 @@ bool tc07_DrmFileMgrPositive_01(void)
 
        pDrmFileMgr = DrmFileMgr::GetInstance();
 
-       nRet = pDrmFileMgr->OpenFileHandler(pDCF, 1, &first_key);
+       nRet = pDrmFileMgr->OpenFileHandler(pDCF, &first_key);
        if (nRet != TADC_SUCCESS)
        {
                printf("tc07_DrmFileMgrPositive_01 - OpenFileHandler() failed : key = %d, file = %s, %x\n", first_key, pDCF, nRet);
@@ -1148,7 +733,7 @@ CATCH:
 
 bool tc07_DrmFileMgrPositive_02(void)
 {
-       const char *pDCF = tzplatform_mkpath(TZ_SYS_DATA,"drm_test/DCF/8SPXfqc6iL.tpk");
+       const char *pDCF = TEST_DATA_DIR "/DCF/8SPXfqc6iL.tpk";
        int nRet = TADC_SUCCESS;
 
        DrmFileMgr* pDrmFileMgr = NULL;
@@ -1166,7 +751,7 @@ bool tc07_DrmFileMgrPositive_02(void)
 
        pDrmFileMgr = DrmFileMgr::GetInstance();
 
-       nRet = pDrmFileMgr->OpenFileHandler(pDCF, 1, &second_key);
+       nRet = pDrmFileMgr->OpenFileHandler(pDCF, &second_key);
        if (nRet != TADC_SUCCESS)
        {
                printf("tc07_DrmFileMgrPositive_02 - OpenFileHandler() failed : key = %d, file = %s, %x\n", second_key, pDCF, nRet);
@@ -1233,7 +818,7 @@ CATCH:
 
 bool tc07_DrmFileMgrPositive_03(void)
 {
-       const char *pDCF  = tzplatform_mkpath(TZ_SYS_DATA,"drm_test/DCF/FightGuiIF.tpk");
+       const char *pDCF  = TEST_DATA_DIR "/DCF/FightGuiIF.tpk";
        int nRet = TADC_SUCCESS;
 
        DrmFileMgr* pDrmFileMgr = NULL;
@@ -1252,7 +837,7 @@ bool tc07_DrmFileMgrPositive_03(void)
 
        pDrmFileMgr = DrmFileMgr::GetInstance();
 
-       nRet = pDrmFileMgr->OpenFileHandler(pDCF, 1, &third_key);
+       nRet = pDrmFileMgr->OpenFileHandler(pDCF, &third_key);
        if (nRet != TADC_SUCCESS)
        {
                printf("tc07_DrmFileMgrPositive_03 - OpenFileHandler() failed : key = %d, file = %s, %x\n", third_key, pDCF, nRet);
@@ -1319,7 +904,7 @@ CATCH:
 
 bool tc08_DrmFileMgrPositive_GetFileHandler_01(void)
 {
-       const char *pDCF = tzplatform_mkpath(TZ_SYS_DATA,"drm_test/DCF/38EIfBurLJ.tpk");
+       const char *pDCF = TEST_DATA_DIR "/DCF/38EIfBurLJ.tpk";
        int nRet = TADC_SUCCESS;
 
        DrmFileMgr* pDrmFileMgr = NULL;
@@ -1398,7 +983,7 @@ CATCH:
 
 bool tc08_DrmFileMgrPositive_GetFileHandler_02(void)
 {
-       const char *pDCF = tzplatform_mkpath(TZ_SYS_DATA,"drm_test/DCF/8SPXfqc6iL.tpk");
+       const char *pDCF = TEST_DATA_DIR "/DCF/8SPXfqc6iL.tpk";
        int nRet = TADC_SUCCESS;
 
        DrmFileMgr* pDrmFileMgr = NULL;
@@ -1477,7 +1062,7 @@ CATCH:
 
 bool tc08_DrmFileMgrPositive_GetFileHandler_03(void)
 {
-       const char *pDCF = tzplatform_mkpath(TZ_SYS_DATA,"drm_test/DCF/FightGuiIF.tpk");
+       const char *pDCF = TEST_DATA_DIR "/DCF/FightGuiIF.tpk";
        int nRet = TADC_SUCCESS;
 
        DrmFileMgr* pDrmFileMgr = NULL;
@@ -1556,7 +1141,7 @@ CATCH:
 
 bool tc09_DrmFileMgrPositive_FileAPI_01(void)
 {
-       const char *pDCF = tzplatform_mkpath(TZ_SYS_DATA,"drm_test/DCF/38EIfBurLJ.tpk");
+       const char *pDCF = TEST_DATA_DIR "/DCF/38EIfBurLJ.tpk";
        int nRet = TADC_SUCCESS;
 
        DrmFileMgr* pDrmFileMgr = NULL;
@@ -1646,7 +1231,7 @@ bool tc09_DrmFileMgrPositive_FileAPI_01(void)
                DrmCurOffset = pDcfHandler->DrmTell();
                if (DrmCurOffset != pDcfHandler->m_DrmCurOffset)
                {
-                       printf("tc09_DrmFileMgrPositive_FileAPI_01 - DrmCurOffset Comparison failed (SEEK_END, forward) : origin = %lld, result = %lld, i = %%lld\n", DrmCurOffset, pDcfHandler->m_DrmCurOffset, i);
+                       printf("tc09_DrmFileMgrPositive_FileAPI_01 - DrmCurOffset Comparison failed (SEEK_END, forward) : origin = %lld, result = %lld, i = %lld\n", DrmCurOffset, pDcfHandler->m_DrmCurOffset, i);
                        goto CATCH;
                }
        }
@@ -1732,7 +1317,7 @@ CATCH:
 
 bool tc09_DrmFileMgrPositive_FileAPI_02(void)
 {
-       const char *pDCF = tzplatform_mkpath(TZ_SYS_DATA,"drm_test/DCF/8SPXfqc6iL.tpk");
+       const char *pDCF = TEST_DATA_DIR "/DCF/8SPXfqc6iL.tpk";
        int nRet = TADC_SUCCESS;
 
        DrmFileMgr* pDrmFileMgr = NULL;
@@ -1908,7 +1493,7 @@ CATCH:
 
 bool tc09_DrmFileMgrPositive_FileAPI_03(void)
 {
-       const char *pDCF = tzplatform_mkpath(TZ_SYS_DATA,"drm_test/DCF/FightGuiIF.tpk");
+       const char *pDCF = TEST_DATA_DIR "/DCF/FightGuiIF.tpk";
        int nRet = TADC_SUCCESS;
 
        DrmFileMgr* pDrmFileMgr = NULL;
@@ -2237,200 +1822,62 @@ bool tc12_TADC_SetDeviceInfo_01(void)
        }
        printf("DUID=%s\n", (char*)t_DeviceInfo.DUID);
        printf("tc12_TADC_SetDeviceInfo_01() finished! -------- success \n");
-       
+
        return true;
 }
 
-bool
-tc13_DTappsInstallLicense_01(void)
+bool tc13_DTappsInstallLicense_01(void)
 {
-       int nRet = TADC_SUCCESS;
-       char Buf[1024*10] = {0, };      
-       const char *pFirstRo = tzplatform_mkpath(TZ_SYS_DATA,"drm_test/RO/38EIfBurLJ-1.0.2.ro");
-       FILE* fd = NULL;
-       int     nReadLen = 0;
-       long lSize = 0;
-       bool res = true;
-
        printf("tc13_DTappsInstallLicense_01() -------- Started! \n");
 
-       fd = fopen(pFirstRo, "rb");
-       if (fd == NULL)
-       {
-               printf("File is not exist! : %s\n", pFirstRo);
-               res = false;
-               goto CATCH;
-       }
-
-       fseek(fd, 0, SEEK_END);
-       lSize = ftell(fd);
-       if (lSize < 0)
-       {
-               printf("fseek() and ftell() failed.");
-               res = false;
-               goto CATCH;
-       }
-       rewind(fd);
+       const char *pFirstRo = TEST_DATA_DIR "/RO/38EIfBurLJ-1.0.2.ro";
 
-       memset(Buf, 0x00, sizeof(Buf));
-       nReadLen = fread(Buf, 1, lSize, fd);
-       if (nReadLen >= sizeof(Buf))
-       {
-               printf("Buffer error! : %s\n", pFirstRo);
-               goto CATCH;
-       }
+       auto buf = _read_ro_file(pFirstRo);
 
-       if (nReadLen != lSize)
-       {
-               printf("File read error! : %s\n", pFirstRo);
-               res = false;
-               goto CATCH;
-       }
-
-       nRet = DTappsInstallLicense(Buf);
-       if (nRet != TADC_SUCCESS)
-       {
+       int nRet = DTappsInstallLicense(reinterpret_cast<char *>(buf.data()));
+       if (nRet != TADC_SUCCESS) {
                printf("tc13_DTappsInstallLicense_01() failed. nRet=%d\n", nRet);
-               res = false;
-               goto CATCH;
+               return false;
        }
 
        printf("tc13_DTappsInstallLicense_01() finished! -------- success \n");
-
-CATCH:
-       if (fd != NULL)
-       {
-               fclose(fd);
-       }
-       return res;
+       return true;
 }
 
-bool
-tc13_DTappsInstallLicense_02(void)
+bool tc13_DTappsInstallLicense_02(void)
 {
-       int     nRet = TADC_SUCCESS;
-       char Buf[1024*10] = {0, };      
-       const char *pFirstRo = tzplatform_mkpath(TZ_SYS_DATA,"drm_test/RO/8SPXfqc6iL-1.0.0.ro");
-       FILE* fd = NULL;
-       int     nReadLen = 0;
-       long lSize = 0;
-       bool res = true;
-
        printf("tc13_DTappsInstallLicense_02() -------- Started! \n");
 
-       fd = fopen(pFirstRo, "rb");
-       if (fd == NULL)
-       {
-               printf("File is not exist! : %s\n", pFirstRo);
-               res = false;
-               goto CATCH;
-       }
-
-       fseek(fd, 0, SEEK_END);
-       lSize = ftell(fd);
-       if (lSize < 0)
-       {
-               printf("fseek() and ftell() failed.");
-               res = false;
-               goto CATCH;
-       }
-       rewind(fd);
-
-       memset(Buf, 0x00, sizeof(Buf));
-       nReadLen = fread(Buf, 1, lSize, fd);
-       if (nReadLen >= sizeof(Buf))
-       {
-               printf("Buffer error! : %s\n", pFirstRo);
-               goto CATCH;
-       }
+       const char *pFirstRo = TEST_DATA_DIR "/RO/8SPXfqc6iL-1.0.0.ro";
 
-       if (nReadLen != lSize)
-       {
-               printf("File read error! : %s\n", pFirstRo);
-               res = false;
-               goto CATCH;
-       }
+       auto buf = _read_ro_file(pFirstRo);
 
-       nRet = DTappsInstallLicense(Buf);
-       if (nRet != TADC_SUCCESS)
-       {
+       int nRet = DTappsInstallLicense(reinterpret_cast<char *>(buf.data()));
+       if (nRet != TADC_SUCCESS) {
                printf("tc13_DTappsInstallLicense_02() failed. nRet=%d\n", nRet);
-               res = false;
-               goto CATCH;
+               return false;
        }
 
        printf("tc13_DTappsInstallLicense_02() finished! -------- success \n");
-
-CATCH:
-       if (fd != NULL)
-       {
-               fclose(fd);
-       }
-       return res;
+       return true;
 }
 
-bool
-tc13_DTappsInstallLicense_03(void)
+bool tc13_DTappsInstallLicense_03(void)
 {
-       int     nRet = TADC_SUCCESS;
-       char Buf[1024*10] = {0, };      
-       const char *pFirstRo = tzplatform_mkpath(TZ_SYS_DATA,"drm_test/RO/FightGuiIF-1.0.0.ro");
-       FILE* fd = NULL;
-       int     nReadLen = 0;
-       long lSize = 0;
-       bool res = true;
-
        printf("tc13_DTappsInstallLicense_03() -------- Started! \n");
 
-       fd = fopen(pFirstRo, "rb");
-       if (fd == NULL)
-       {
-               printf("File is not exist! : %s\n", pFirstRo);
-               res = false;
-               goto CATCH;
-       }
-
-       fseek(fd, 0, SEEK_END);
-       lSize = ftell(fd);
-       if (lSize < 0)
-       {
-               printf("fseek() and ftell() failed.");
-               res = false;
-               goto CATCH;
-       }
-       rewind(fd);
+       const char *pFirstRo = TEST_DATA_DIR "/RO/FightGuiIF-1.0.0.ro";
 
-       memset(Buf, 0x00, sizeof(Buf));
-       nReadLen = fread(Buf, 1, lSize, fd);
-       if (nReadLen >= sizeof(Buf))
-       {
-               printf("Buffer error! : %s\n", pFirstRo);
-               goto CATCH;
-       }
-
-       if (nReadLen != lSize)
-       {
-               printf("File read error! : %s\n", pFirstRo);
-               res = false;
-               goto CATCH;
-       }
+       auto buf = _read_ro_file(pFirstRo);
 
-       nRet = DTappsInstallLicense(Buf);
-       if (nRet != TADC_SUCCESS)
-       {
+       int nRet = DTappsInstallLicense(reinterpret_cast<char *>(buf.data()));
+       if (nRet != TADC_SUCCESS) {
                printf("tc13_DTappsInstallLicense_03() failed. nRet=%d\n", nRet);
-               res = false;
-               goto CATCH;
+               return false;
        }
 
        printf("tc13_DTappsInstallLicense_03() finished! -------- success \n");
-
-CATCH:
-       if (fd != NULL)
-       {
-               fclose(fd);
-       }
-       return res;
+       return true;
 }
 
 bool
@@ -2496,10 +1943,10 @@ tc_local_01_drm_tizen_full_test_p(void)
 
     unsigned char duid[33] = {0,};
     const char* cid = "38EIfBurLJ-1.0.2";
-    const char* ro_template_path = tzplatform_mkpath(TZ_SYS_DATA,"drm_test/RO/38EIfBurLJ-1.0.2.ro_template");
+    const char* ro_template_path = TEST_DATA_DIR "/RO/38EIfBurLJ-1.0.2.ro_template";
 
-    const char* encrypted_file_path = tzplatform_mkpath(TZ_SYS_DATA,"drm_test/DCF/38EIfBurLJ.tpk");
-    const char* plaintext_file_path = tzplatform_mkpath(TZ_SYS_DATA,"drm_test/DecryptedApp/38EIfBurLJ_dec.tpk");
+    const char* encrypted_file_path = TEST_DATA_DIR "/DCF/38EIfBurLJ.tpk";
+    const char* plaintext_file_path = TEST_DATA_DIR "/DecryptedApp/38EIfBurLJ_dec.tpk";
     const char* decrypted_file_path = "/tmp/38EIfBurLJ.tpk";
 
     int identical = DRMTEST_NOTIDENTICAL;
@@ -2602,35 +2049,38 @@ bool tc15_DrmTdcDecryptPackge_01(void)
 */
 #endif
 
-int main(int argc, char* argv[])
+int main(int, char *[])
 {
-//     return 0;
+       printf(" ---------- Test Tizen DRM core --- Start ....\n");
+       test_drm_core();
+       printf(" ---------- Test Tizen DRM core ---  End  ....\n");
+
 #if 1
        printf(" ---------- Test Tizen DRM v2.0.1 APIs   ---  Start ....    \n");
 
-       int                             bRet = TADC_SUCCESS;
-       
-       char                    ReqBuf[1024*5] = {0, };
-       unsigned int    ReqBufLen = 0;
-       
-       char                    RespBuf[1024*10] = {0, };       
-       unsigned int    RespBufLen = 0;
-       
-//     char                    DecLicenseBuf[1024*10] = {0, }; 
-//     unsigned int    DecLicenseBufLen = 0;
-       
-       char                    LicenseUrl[1024] = {0, };
-       unsigned int    LicenseUrlLen = 0;
-       
+       int bRet = TADC_SUCCESS;
+
+       char ReqBuf[1024*5] = {0, };
+       unsigned int ReqBufLen = 0;
+
+       char RespBuf[1024*10] = {0, };
+       unsigned int RespBufLen = 0;
+
+//     char DecLicenseBuf[1024*10] = {0, };
+//     unsigned int DecLicenseBufLen = 0;
+
+       char LicenseUrl[1024] = {0, };
+       unsigned int LicenseUrlLen = 0;
+
        //2011.03.08
-       //DrmTdcFileHeader      TDCFileHeader;
-//     char    cid[1024] = {0, };
-//     char    riurl[1024] = {0, };
-       
-       char    testFileName[256] = {0, };
-       char    tempBuf[256] = {0, };
+       //DrmTdcFileHeader TDCFileHeader;
+//     char cid[1024] = {0, };
+//     char riurl[1024] = {0, };
+
+       char testFileName[256] = {0, };
+       char tempBuf[256] = {0, };
 
-       bool    isOk = false;
+       bool isOk = false;
 
        //----------------------------------------------------------------------------------------------------
        // 0. Static TC running
@@ -2867,7 +2317,7 @@ int main(int argc, char* argv[])
        printf("===============================================================================\n");
        printf ("Enter test file name  -->  ");
 
-       isOk = scanf("%s", testFileName); 
+       isOk = scanf("%s", testFileName);
        if (isOk < 1)
        {
                printf ("Input value wrong! scanf() failed!!");
@@ -2884,15 +2334,15 @@ int main(int argc, char* argv[])
        printf("%s file is TADC file!\n", testFileName);
 
        //----------------------------------------------------------------------------------------------------
-       // 2. Make PurchaseRequest Data 
+       // 2. Make PurchaseRequest Data
        //----------------------------------------------------------------------------------------------------
        printf("\n2. Make PurchaseRequest Data  Start  ----------------------------------------\n");
-       
+
        memset(ReqBuf, 0x00, sizeof(ReqBuf));
        memset(LicenseUrl, 0x00, sizeof(LicenseUrl));
        ReqBufLen = sizeof(ReqBuf);
        LicenseUrlLen = sizeof(LicenseUrl);
-       
+
        bRet = drm_tizen_generate_purchase_request(testFileName, ReqBuf, &ReqBufLen, LicenseUrl, &LicenseUrlLen);
        if (bRet == false)
        {
@@ -2900,7 +2350,7 @@ int main(int argc, char* argv[])
                return 0;
        }
 
-       printf("drm_tizen_generate_purchase_request - ReqBufLen : %d,  License Url : %s   \n", ReqBufLen, LicenseUrl);  
+       printf("drm_tizen_generate_purchase_request - ReqBufLen : %d,  License Url : %s   \n", ReqBufLen, LicenseUrl);
        if ((bRet = _write_logfile("Request_1.dat", ReqBuf, ReqBufLen-1)) == false)
        {
                printf(" drm_tizen_generate_purchase_request _write_logfile Error!  \n");
@@ -2909,9 +2359,9 @@ int main(int argc, char* argv[])
 
        //break.... HTTP Request & Reaponse Processing...
        printf ("Enter any key after create Response_1.dat file. -->  ");
-       scanf ("%s", tempBuf); 
+       std::cin >> tempBuf;
 
-       memset(RespBuf, 0x00, sizeof(RespBuf)); 
+       memset(RespBuf, 0x00, sizeof(RespBuf));
        RespBufLen = sizeof(RespBuf);
        if ((bRet = _read_logfile("Response_1.dat", RespBuf, &RespBufLen)) == false)
        {
@@ -2920,15 +2370,15 @@ int main(int argc, char* argv[])
        }
 
        //----------------------------------------------------------------------------------------------------
-       // 3. Make License Request Data  
+       // 3. Make License Request Data
        //----------------------------------------------------------------------------------------------------
        printf("\n3. Make License Request Data  Start  ----------------------------------------\n");
-       
+
        memset(ReqBuf, 0x00, sizeof(ReqBuf));
        memset(LicenseUrl, 0x00, sizeof(LicenseUrl));
        ReqBufLen = sizeof(ReqBuf);
-       LicenseUrlLen = sizeof(LicenseUrl);     
-       
+       LicenseUrlLen = sizeof(LicenseUrl);
+
        bRet = drm_tizen_generate_license_request(RespBuf,  RespBufLen, ReqBuf, &ReqBufLen, LicenseUrl, &LicenseUrlLen);
        if (bRet != TADC_SUCCESS)
        {
@@ -2945,9 +2395,9 @@ int main(int argc, char* argv[])
 
        //break.... HTTP Request & Reaponse Processing...
        printf ("Enter any key after create Response_2.dat file. -->  ");
-       scanf ("%s", tempBuf); 
+       std::cin >> tempBuf;
 
-       memset(RespBuf, 0x00, sizeof(RespBuf)); 
+       memset(RespBuf, 0x00, sizeof(RespBuf));
        RespBufLen = sizeof(RespBuf);
        if ((bRet = _read_logfile("Response_2.dat", RespBuf, &RespBufLen)) == false)
        {