From: so.yu Date: Fri, 29 Mar 2013 08:24:50 +0000 (+0900) Subject: add installing p12 for cert-mgr X-Git-Tag: 2.1b_release~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=35cf89ca79abe0ec04dd46cbdb0f59cd1ed482a2;p=platform%2Fcore%2Fsecurity%2Fcert-svc.git add installing p12 for cert-mgr Change-Id: I3c61454e3e7af958bcd196eb04fab5c0a53fd437 Signed-off-by: so.yu --- diff --git a/vcore/src/vcore/pkcs12.c b/vcore/src/vcore/pkcs12.c old mode 100644 new mode 100755 index ffaaa6c..8dd6fa7 --- a/vcore/src/vcore/pkcs12.c +++ b/vcore/src/vcore/pkcs12.c @@ -35,6 +35,8 @@ #include #include #include +#include +#include #define SYSCALL(call) while(((call) == -1) && (errno == EINTR)) @@ -179,6 +181,8 @@ int c_certsvc_pkcs12_import(const char *path, const char *password, const gchar gsize i, n; gchar *data; gsize length; + static int initFlag = 0; + const char appInfo[] = "certsvcp12"; certv = NULL; pkvalue = NULL; @@ -296,6 +300,53 @@ int c_certsvc_pkcs12_import(const char *path, const char *password, const gchar goto free_data; } result = CERTSVC_SUCCESS; + +#if 1 + LOGD("( %s, %s)", path, password); + void* pSymAddr = NULL; + void* pInitAddr = NULL; + typedef int (*InsertPkcs12FuncPointer)(const char*, const char*); + typedef void (*InitAppInfoPointer)(const char*, const char*); + + InsertPkcs12FuncPointer pInsertPkcs12FuncPointer = NULL; + InitAppInfoPointer pInit = NULL; + + void* dlHandle = dlopen("/usr/lib/osp/libosp-appfw.so", RTLD_LAZY); + if (!dlHandle) + { + LOGD("Failed to open so with reason : %s", dlerror()); + goto free_data; + } + + pInsertPkcs12FuncPointer = (InsertPkcs12FuncPointer)dlsym(dlHandle, "InsertPkcs12Content"); + if (dlerror() != NULL) + { + LOGD("Failed to find InsertPkcs12Content symbol : %s", dlerror()); + goto free_data; + } + + if(initFlag == 0) + { + pInit = (InitAppInfoPointer)dlsym(dlHandle, "InitWebAppInfo"); + if (dlerror() != NULL) + { + LOGD("Failed to find InitWebAppInfo symbol : %s", dlerror()); + goto free_data; + } + + pInit(appInfo, NULL); + initFlag = 1; + } + + int errCode = pInsertPkcs12FuncPointer(path, password); + if (errCode != 0) + { + LOGD("dlHandle is not able to call function"); + goto free_data; + } + dlclose(dlHandle); +#endif + free_data: g_free(data); clean_cert_chain_and_pkey: