From 35cf89ca79abe0ec04dd46cbdb0f59cd1ed482a2 Mon Sep 17 00:00:00 2001 From: "so.yu" Date: Fri, 29 Mar 2013 17:24:50 +0900 Subject: [PATCH] add installing p12 for cert-mgr Change-Id: I3c61454e3e7af958bcd196eb04fab5c0a53fd437 Signed-off-by: so.yu --- vcore/src/vcore/pkcs12.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) mode change 100644 => 100755 vcore/src/vcore/pkcs12.c 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: -- 2.7.4