+static bool m_initWebApp = false;
+
+Tizen::Base::ByteBuffer *DecryptChunkByTrustZone(
+ Tizen::Base::ByteBuffer *appInfo,
+ const unsigned char *inBuffer,
+ int inBufSize)
+{
+ using namespace Tizen::Base;
+
+ if (!m_initWebApp) {
+ char* pAppId = null;
+ pAppId = (char*)calloc(appInfo->GetRemaining()+1, 1);
+ memcpy(pAppId, appInfo->GetPointer(), appInfo->GetRemaining());
+
+ InitWebAppInfo(pAppId, "");
+ free (pAppId);
+ m_initWebApp = true;
+ }
+
+ Tizen::Security::Crypto::_TrustZoneService* pInstance;
+ pInstance = Tizen::Security::Crypto::_TrustZoneService::GetInstance();
+
+ ByteBuffer pBuf;
+ pBuf.Construct(inBufSize);
+ const byte *pByte = reinterpret_cast<const byte*>(inBuffer);
+ pBuf.SetArray(pByte, 0, inBufSize);
+ pBuf.Flip();
+
+ ByteBuffer *getBuffer = pInstance->_TrustZoneService::DecryptN(*appInfo, pBuf);
+ return getBuffer;
+}