}
result
-_CertServiceProxy::InsertPkcs12Content(char* pPkcs12FilePath, char* pPkcs12ImportPassword)
+_CertServiceProxy::InsertPkcs12Content(char* pPkcs12FilePath, char* pPkcs12ImportPassword, bool checkPrivilege)
{
result r = E_SUCCESS;
result ret = E_SUCCESS;
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());
}
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));
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;
}
return r;
-
}
+
_X509CertificateStoreImpl*
_X509CertificateStoreImpl::GetInstance(X509CertificateStore& x509CertificateStore)
{
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
* - 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.
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_
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);
* - 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.