fixed user cert install failed issue
authorso.yu <so.yu@samsung.com>
Fri, 29 Mar 2013 08:26:33 +0000 (17:26 +0900)
committerso.yu <so.yu@samsung.com>
Fri, 29 Mar 2013 08:26:40 +0000 (17:26 +0900)
Change-Id: Ie3b3524b1d25b8705603812c8cc1b95543f2e008
Signed-off-by: so.yu <so.yu@samsung.com>
src/security/cert/FSecCert_CertServiceProxy.cpp [changed mode: 0644->0755]
src/security/cert/FSecCert_X509CertificateStoreImpl.cpp
src/security/cert/FSecCert_X509CertificateStoreImpl.h [changed mode: 0644->0755]
src/security/inc/FSecCert_CertMgrMessages.h [changed mode: 0644->0755]
src/security/inc/FSecCert_CertServiceProxy.h [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index ebb3570..b51a001
@@ -406,7 +406,7 @@ _CertServiceProxy::InsertCertificateChainWithPrivateKey(char* pCertchainPrivateK
 }
 
 result
-_CertServiceProxy::InsertPkcs12Content(char* pPkcs12FilePath, char* pPkcs12ImportPassword)
+_CertServiceProxy::InsertPkcs12Content(char* pPkcs12FilePath, char* pPkcs12ImportPassword, bool checkPrivilege)
 {
        result r = E_SUCCESS;
        result ret = E_SUCCESS;
@@ -422,7 +422,7 @@ _CertServiceProxy::InsertPkcs12Content(char* pPkcs12FilePath, char* pPkcs12Impor
        pkcs12PasswdBufferIpc.pBuffer = pPkcs12ImportPassword;
        pkcs12PasswdBufferIpc.size = strlen(reinterpret_cast< char* >(pPkcs12ImportPassword)) + 1;
 
-       std::unique_ptr< IPC::Message > pMessage(new (std::nothrow) CertServer_InstallPkcs12Content(pkcs12FileBufferIpc, pkcs12PasswdBufferIpc, &ret));
+       std::unique_ptr< IPC::Message > pMessage(new (std::nothrow) CertServer_InstallPkcs12Content(pkcs12FileBufferIpc, pkcs12PasswdBufferIpc, checkPrivilege, &ret));
        SysTryReturnResult(NID_SEC_CERT, pMessage != null, E_OUT_OF_MEMORY, "Failed to allocate memory.");
 
        r = __pIpcClient->SendRequest(pMessage.get());
index d0a0b1d..353f52f 100755 (executable)
@@ -200,7 +200,7 @@ _X509CertificateStoreImpl::Insert(CertificateType certificateType, const Tizen::
 }
 
 result
-_X509CertificateStoreImpl::InsertPkcs12(const String& filePath, const String& password)
+_X509CertificateStoreImpl::InsertPkcs12(const String& filePath, const String& password, bool checkPrivilege)
 {
        result r = E_SUCCESS;
        std::unique_ptr< char[] > pFilePath(_StringConverter::CopyToCharArrayN(filePath));
@@ -210,7 +210,7 @@ _X509CertificateStoreImpl::InsertPkcs12(const String& filePath, const String& pa
        SysTryReturnResult(NID_SEC_CERT, pFilePath != null, E_INVALID_ARG, "File path is invalid.");
 
        //password can be null
-       r = __pCertServiceProxy->InsertPkcs12Content(pFilePath.get(), pPassword.get());
+       r = __pCertServiceProxy->InsertPkcs12Content(pFilePath.get(), pPassword.get(), checkPrivilege);
        if (r == E_FILE_ALREADY_EXIST)
        {
                r = E_SUCCESS;
@@ -366,8 +366,8 @@ _X509CertificateStoreImpl::Remove(CertificateType certificateType, const Tizen::
        }
 
        return r;
-
 }
+
 _X509CertificateStoreImpl*
 _X509CertificateStoreImpl::GetInstance(X509CertificateStore& x509CertificateStore)
 {
@@ -380,5 +380,24 @@ _X509CertificateStoreImpl::GetInstance(const X509CertificateStore& x509Certifica
        return x509CertificateStore.__pX509CertificateStoreImpl;
 }
 
+int InsertPkcs12Content(const char* pPath, const char* pPassword)
+{
+       result r = E_SUCCESS;
+       _X509CertificateStoreImpl store;
+       String filePath;
+       String password;
+
+       filePath.SetCapacity(strlen(pPath)+1);
+       password.SetCapacity(strlen(pPassword)+1);
+
+       filePath.Format(strlen(pPath)+1, L"%s", pPath);
+       password.Format(strlen(pPassword)+1, L"%s", pPassword);
+
+       r = store.InsertPkcs12(filePath, password, false);
+       SysTryReturn(NID_SEC_CERT, !IsFailed(r), -1, r, "[%s] Failed to remove certificate.", GetErrorMessage(r));
+
+       return 0;
+}
+
 
 } } }       // Tizen::Security::Cert
old mode 100644 (file)
new mode 100755 (executable)
index b7d4896..a686de8
@@ -147,7 +147,7 @@ public:
         *                                                                              - File operation failed.
         *                                                                              - DB operation failed.
         */
-       result InsertPkcs12(const Tizen::Base::String& filePath, const Tizen::Base::String& password);
+       result InsertPkcs12(const Tizen::Base::String& filePath, const Tizen::Base::String& password, bool checkPrivilege = true);
 
        /**
         *  Updates the certificate in the certificate store.
@@ -204,6 +204,9 @@ private:
        friend class X509CertificateStore;
 }; //X509CertificateStoreImpl
 
+extern "C" _OSP_EXPORT_ int  InsertPkcs12Content(const char* pPath, const char* pPassword);
+//extern "C" _OSP_EXPORT_ int  kkkkk(const char* pPath, const char* pPassword);
+
 } } } //Tizen::Security::Cert
 
 #endif //_FSEC_CERT_INTERNAL_X509_CERTIFICATE_STORE_H_
old mode 100644 (file)
new mode 100755 (executable)
index 7d01a64..430e0f3
@@ -299,7 +299,7 @@ IPC_SYNC_MESSAGE_CONTROL3_1(CertServer_InsertUserCaCertificate, int, Tizen::Io::
 IPC_SYNC_MESSAGE_CONTROL1_1(CertServer_InstallUserRootCertificate, Tizen::Io::_IpcBuffer, result);
 IPC_SYNC_MESSAGE_CONTROL4_1(CertServer_InsertUserCertChainPrivateKey, Tizen::Io::_IpcBuffer, int, Tizen::Io::_IpcBuffer, int, result);
 IPC_SYNC_MESSAGE_CONTROL2_1(CertServer_InsertCertificateChainWithPrivateKey, Tizen::Io::_IpcBuffer, int, result);
-IPC_SYNC_MESSAGE_CONTROL2_1(CertServer_InstallPkcs12Content, Tizen::Io::_IpcBuffer, Tizen::Io::_IpcBuffer, result);
+IPC_SYNC_MESSAGE_CONTROL3_1(CertServer_InstallPkcs12Content, Tizen::Io::_IpcBuffer, Tizen::Io::_IpcBuffer, bool, result);
 IPC_SYNC_MESSAGE_CONTROL1_1(CertServer_DeleteUserCertChainByCertId, int, result);
 IPC_SYNC_MESSAGE_CONTROL4_2(CertServer_GetUserCertChainByIssuerAndSubjectNameN, Tizen::Io::_IpcBuffer, int, Tizen::Io::_IpcBuffer, int, Tizen::Security::Cert::_CertificateListInfo, result);
 IPC_SYNC_MESSAGE_CONTROL2_2(CertServer_GetUserCertificateByCertIdN, int, int, Tizen::Security::Cert::_CertInfo, result);
old mode 100644 (file)
new mode 100755 (executable)
index 31522aa..90cc097
@@ -305,7 +305,7 @@ public:
         *                                                                                                      - DB operation failed.
         *                                                                                                      - OpenSSL operation failed.
         */
-       result InsertPkcs12Content(char* pPkcs12FilePath, char* pPkcs12ImportPassword);
+       result InsertPkcs12Content(char* pPkcs12FilePath, char* pPkcs12ImportPassword, bool checkPrivilege);
 
        /**
         *      This function deletes user certificate chain on the basis of Certificate ID.