From: so.yu Date: Fri, 29 Mar 2013 08:26:33 +0000 (+0900) Subject: fixed user cert install failed issue X-Git-Tag: accepted/tizen_2.1/20130425.034849~200 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=14d1b210ee62be05d66547276680f3b91b7966a2;p=framework%2Fosp%2Fappfw.git fixed user cert install failed issue Change-Id: Ie3b3524b1d25b8705603812c8cc1b95543f2e008 Signed-off-by: so.yu --- diff --git a/src/security/cert/FSecCert_CertServiceProxy.cpp b/src/security/cert/FSecCert_CertServiceProxy.cpp old mode 100644 new mode 100755 index ebb3570..b51a001 --- a/src/security/cert/FSecCert_CertServiceProxy.cpp +++ b/src/security/cert/FSecCert_CertServiceProxy.cpp @@ -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()); diff --git a/src/security/cert/FSecCert_X509CertificateStoreImpl.cpp b/src/security/cert/FSecCert_X509CertificateStoreImpl.cpp index d0a0b1d..353f52f 100755 --- a/src/security/cert/FSecCert_X509CertificateStoreImpl.cpp +++ b/src/security/cert/FSecCert_X509CertificateStoreImpl.cpp @@ -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 diff --git a/src/security/cert/FSecCert_X509CertificateStoreImpl.h b/src/security/cert/FSecCert_X509CertificateStoreImpl.h old mode 100644 new mode 100755 index b7d4896..a686de8 --- a/src/security/cert/FSecCert_X509CertificateStoreImpl.h +++ b/src/security/cert/FSecCert_X509CertificateStoreImpl.h @@ -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_ diff --git a/src/security/inc/FSecCert_CertMgrMessages.h b/src/security/inc/FSecCert_CertMgrMessages.h old mode 100644 new mode 100755 index 7d01a64..430e0f3 --- a/src/security/inc/FSecCert_CertMgrMessages.h +++ b/src/security/inc/FSecCert_CertMgrMessages.h @@ -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); diff --git a/src/security/inc/FSecCert_CertServiceProxy.h b/src/security/inc/FSecCert_CertServiceProxy.h old mode 100644 new mode 100755 index 31522aa..90cc097 --- a/src/security/inc/FSecCert_CertServiceProxy.h +++ b/src/security/inc/FSecCert_CertServiceProxy.h @@ -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.