int SsClientDecrypt(const char* pAppId, int idLen, const char* pBuffer, int bufLen, char** ppDecryptedBuffer, int* pDecryptedBufLen);
+int SsClientEncryptPreloadedApplication(const char* pBuffer, int bufLen, char** ppEncryptedBuffer, int* pEncryptedBufLen);
+int SsClientDecryptPreloadedApplication(const char* pBuffer, int bufLen, char** ppDecryptedBuffer, int* pEncryptedBufLen);
free(pDuk);
return result;
}
+
+int SsClientEncryptPreloadedApplication(const char* pBuffer, int bufLen, char** ppEncryptedBuffer, int* pEncryptedBufLen)
+{
+ int result = 0;
+ char duk[36] = {0,};
+
+ if(!pBuffer || bufLen ==0)
+ {
+ SLOGE("Parameter error");
+ result = SS_PARAM_ERROR;
+ goto Final;
+ }
+
+ if(DoCipher(pBuffer, bufLen, ppEncryptedBuffer, pEncryptedBufLen, duk, 1) != 1)
+ {
+ SLOGE("failed to decrypt data");
+ result = SS_ENCRYPTION_ERROR;
+ goto Final;
+ }
+
+ result = 1;
+
+Final:
+ return result;
+}
+
+int SsClientDecryptPreloadedApplication(const char* pBuffer, int bufLen, char** ppDecryptedBuffer, int* pDecryptedBufLen)
+{
+ int result = 0;
+ char duk[36] = {0,};
+
+ if(!pBuffer || bufLen ==0)
+ {
+ SLOGE("Parameter error");
+ result = SS_PARAM_ERROR;
+ goto Final;
+ }
+
+ if(DoCipher(pBuffer, bufLen, ppDecryptedBuffer, pDecryptedBufLen, duk, 0) != 1)
+ {
+ SLOGE("failed to decrypt data");
+ result = SS_DECRYPTION_ERROR;
+ goto Final;
+ }
+
+ result = 1;
+
+Final:
+ return result;
+}
Error:
return -(ret);
}
+
+SS_API
+int ssm_encrypt_preloaded_application(const char* pBuffer, int bufLen, char** ppEncryptedBuffer, int* pEncryptedBufLen)
+{
+ int ret = 0;
+
+ if(!pBuffer || bufLen ==0)
+ {
+ SLOGE("Parameter error.\n");
+ ret = SS_PARAM_ERROR;
+ goto Error;
+ }
+
+ ret = SsClientEncryptPreloadedApplication(pBuffer, bufLen, ppEncryptedBuffer, pEncryptedBufLen);
+ if(ret == 1) // success
+ {
+ SLOGI("Application decryption succeeded.\n");
+ return 0;
+ }
+ else // fail
+ SLOGE("Application decryption failed.\n");
+
+Error:
+ return -(ret);
+}
+
+SS_API
+int ssm_decrypt_preloaded_application(const char* pBuffer, int bufLen, char** ppDecryptedBuffer, int* pDecryptedBufLen)
+{
+ int ret = 0;
+
+ if(!pBuffer || bufLen ==0)
+ {
+ SLOGE("Parameter error.\n");
+ ret = SS_PARAM_ERROR;
+ goto Error;
+ }
+
+ ret = SsClientDecryptPreloadedApplication(pBuffer, bufLen, ppDecryptedBuffer, pDecryptedBufLen);
+ if(ret == 1) // success
+ {
+ SLOGI("Application decryption succeeded.\n");
+ return 0;
+ }
+ else // fail
+ SLOGE("Application decryption failed.\n");
+
+Error:
+ return -(ret);
+}
int ssm_encrypt(const char* pAppId, int idLen, const char* pBuffer, int bufLen, char** ppEncryptedBuffer, int* pEncryptedBufLen);
int ssm_decrypt(const char* pAppId, int idLen, const char* pBuffer, int bufLen, char** ppDecryptedBuffer, int* pDecryptedBufLen);
+int ssm_encrypt_preloaded_application(const char* pBuffer, int bufLen, char** ppEncryptedBuffer, int* pEncryptedBufLen);
+int ssm_decrypt_preloaded_application(const char* pBuffer, int bufLen, char** ppDecryptedBuffer, int* pDecryptedBufLen);
+
+
#ifdef __cplusplus
}
#endif