Rename AppCustomTrustAnchor to TrustAnchor 01/118801/1
authorsangwan.kwon <sangwan.kwon@samsung.com>
Tue, 14 Mar 2017 04:18:06 +0000 (13:18 +0900)
committersangwan.kwon <sangwan.kwon@samsung.com>
Tue, 14 Mar 2017 06:08:40 +0000 (15:08 +0900)
Change-Id: Ic44a7a07fc0eb337a812d76bf139c7d0c5dcf9e9
Signed-off-by: sangwan.kwon <sangwan.kwon@samsung.com>
13 files changed:
src/transec/Api.cpp
src/transec/CMakeLists.txt
src/transec/TrustAnchor.cpp [moved from src/transec/AppCustomTrustAnchor.cpp with 84% similarity]
src/transec/TrustAnchor.h [moved from src/transec/AppCustomTrustAnchor.h with 61% similarity]
src/transec/acta/app-custom-trust-anchor.h [deleted file]
src/transec/tanchor/error.h [moved from src/transec/acta/acta-error.h with 66% similarity]
src/transec/tanchor/trust-anchor.h [new file with mode: 0644]
tests/transec/CMakeLists.txt
tests/transec/test-acta-installer.cpp [deleted file]
tests/transec/test-capi-installer.cpp
tests/transec/test-capi-launcher.cpp
tests/transec/test-installer.cpp [new file with mode: 0644]
tests/transec/test-launcher.cpp [moved from tests/transec/test-acta-launcher.cpp with 80% similarity]

index 69578ab..be85acb 100644 (file)
  * @file        Api.cpp
  * @author      Sangwan Kwon (sangwan.kwon@samsung.com)
  * @version     0.1
- * @brief       Implementation of App custom trust anchor CAPI.
+ * @brief       Implementation of trust anchor CAPI.
  */
-#include "acta/app-custom-trust-anchor.h"
+#include "tanchor/trust-anchor.h"
 
-#include "AppCustomTrustAnchor.h"
+#include "TrustAnchor.h"
 
 using namespace transec;
 
-int acta_global_install(const char *package_id,
-                                               const char *app_certificates_path,
-                                               bool with_system_certificates)
+int trust_anchor_global_install(const char *package_id,
+                                                               const char *app_certificates_path,
+                                                               bool with_system_certificates)
 {
-       AppCustomTrustAnchor acta(package_id, app_certificates_path);
-       return acta.install(with_system_certificates);
+       TrustAnchor ta(package_id, app_certificates_path);
+       return ta.install(with_system_certificates);
 }
 
-int acta_usr_install(const char *package_id,
-                                        const char *app_certificates_path,
-                                        uid_t uid,
-                                        bool with_system_certificates)
+int trust_anchor_usr_install(const char *package_id,
+                                                        const char *app_certificates_path,
+                                                        uid_t uid,
+                                                        bool with_system_certificates)
 {
-       AppCustomTrustAnchor acta(package_id, app_certificates_path, uid);
-       return acta.install(with_system_certificates);
+       TrustAnchor ta(package_id, app_certificates_path, uid);
+       return ta.install(with_system_certificates);
 }
 
-int acta_global_launch(const char *package_id,
-                                          const char *app_certificates_path,
-                                          bool with_system_certificates)
+int trust_anchor_global_launch(const char *package_id,
+                                                          const char *app_certificates_path,
+                                                          bool with_system_certificates)
 {
-       AppCustomTrustAnchor acta(package_id, app_certificates_path);
-       return acta.launch(with_system_certificates);
+       TrustAnchor ta(package_id, app_certificates_path);
+       return ta.launch(with_system_certificates);
 }
 
-int acta_usr_launch(const char *package_id,
-                                       const char *app_certificates_path,
-                                       uid_t uid,
-                                       bool with_system_certificates)
+int trust_anchor_usr_launch(const char *package_id,
+                                                       const char *app_certificates_path,
+                                                       uid_t uid,
+                                                       bool with_system_certificates)
 {
-       AppCustomTrustAnchor acta(package_id, app_certificates_path, uid);
-       return acta.launch(with_system_certificates);
+       TrustAnchor ta(package_id, app_certificates_path, uid);
+       return ta.launch(with_system_certificates);
 }
 
-int acta_global_uninstall(const char *package_id,
-                                                 const char *app_certificates_path)
+int trust_anchor_global_uninstall(const char *package_id,
+                                                                 const char *app_certificates_path)
 {
-       AppCustomTrustAnchor acta(package_id, app_certificates_path);
-       return acta.uninstall();
+       TrustAnchor ta(package_id, app_certificates_path);
+       return ta.uninstall();
 }
 
-int acta_usr_uninstall(const char *package_id,
-                                          const char *app_certificates_path,
-                                          uid_t uid)
+int trust_anchor_usr_uninstall(const char *package_id,
+                                                          const char *app_certificates_path,
+                                                          uid_t uid)
 {
-       AppCustomTrustAnchor acta(package_id, app_certificates_path, uid);
-       return acta.uninstall();
+       TrustAnchor ta(package_id, app_certificates_path, uid);
+       return ta.uninstall();
 }
index 196d5e1..79a6765 100644 (file)
@@ -27,7 +27,7 @@ SET(${TARGET_TRANSEC_LIB}_SRCS
        Exception.cpp
        Api.cpp
        Certificate.cpp
-       AppCustomTrustAnchor.cpp
+       TrustAnchor.cpp
 )
 
 INCLUDE_DIRECTORIES(
@@ -53,12 +53,12 @@ TARGET_LINK_LIBRARIES(${TARGET_TRANSEC_LIB}
 INSTALL(TARGETS ${TARGET_TRANSEC_LIB} DESTINATION ${LIB_INSTALL_DIR})
 
 INSTALL(FILES
-                       AppCustomTrustAnchor.h
+                       TrustAnchor.h
                DESTINATION
                        ${INCLUDEDIR}/cert-svc/transec
 )
 
 INSTALL(DIRECTORY
-                       acta
+                       tanchor
                DESTINATION
                        ${INCLUDEDIR})
similarity index 84%
rename from src/transec/AppCustomTrustAnchor.cpp
rename to src/transec/TrustAnchor.cpp
index dd2dea0..c67c1eb 100644 (file)
  *    limitations under the License.
  */
 /*
- * @file        AppCustomTrustAnchor.cpp
+ * @file        TrustAnchor.cpp
  * @author      Sangwan Kwon (sangwan.kwon@samsung.com)
  * @version     0.1
- * @brief       Implementation of App custom trust anchor
+ * @brief       Implementation of trust anchor
  */
-#include "AppCustomTrustAnchor.h"
+#include "TrustAnchor.h"
 
 #include <climits>
 #include <cerrno>
@@ -55,7 +55,7 @@ const std::string NEW_LINE("\n");
 
 } // namespace anonymous
 
-class AppCustomTrustAnchor::Impl {
+class TrustAnchor::Impl {
 public:
        explicit Impl(const std::string &packageId,
                                  const std::string &certsDir,
@@ -88,9 +88,9 @@ private:
        std::vector<std::string> m_customCertsData;
 };
 
-AppCustomTrustAnchor::Impl::Impl(const std::string &packageId,
-                                                                const std::string &certsDir,
-                                                                uid_t uid) noexcept :
+TrustAnchor::Impl::Impl(const std::string &packageId,
+                                               const std::string &certsDir,
+                                               uid_t uid) noexcept :
        m_packageId(packageId),
        m_appCertsPath(certsDir),
        m_uid(uid),
@@ -102,8 +102,8 @@ AppCustomTrustAnchor::Impl::Impl(const std::string &packageId,
        m_customCertNameSet(),
        m_customCertsData() {}
 
-AppCustomTrustAnchor::Impl::Impl(const std::string &packageId,
-                                                                const std::string &certsDir) noexcept :
+TrustAnchor::Impl::Impl(const std::string &packageId,
+                                               const std::string &certsDir) noexcept :
        m_packageId(packageId),
        m_appCertsPath(certsDir),
        m_uid(-1),
@@ -113,15 +113,15 @@ AppCustomTrustAnchor::Impl::Impl(const std::string &packageId,
        m_customCertNameSet(),
        m_customCertsData() {}
 
-std::string AppCustomTrustAnchor::Impl::readLink(const std::string &path) const
+std::string TrustAnchor::Impl::readLink(const std::string &path) const
 {
        std::vector<char> buf(PATH_MAX);
        ssize_t count = readlink(path.c_str(), buf.data(), buf.size());
        return std::string(buf.data(), (count > 0) ? count : 0);
 }
 
-void AppCustomTrustAnchor::Impl::linkTo(const std::string &src,
-                                                                               const std::string &dst) const
+void TrustAnchor::Impl::linkTo(const std::string &src,
+                                                          const std::string &dst) const
 {
        errno = 0;
        int ret = ::symlink(src.c_str(), dst.c_str());
@@ -130,7 +130,7 @@ void AppCustomTrustAnchor::Impl::linkTo(const std::string &src,
                                                           "[" + std::to_string(errno) + "]");
 }
 
-void AppCustomTrustAnchor::Impl::preInstall(void) const
+void TrustAnchor::Impl::preInstall(void) const
 {
        runtime::File customBaseDir(this->m_customBasePath);
        if (customBaseDir.exists()) {
@@ -153,7 +153,7 @@ void AppCustomTrustAnchor::Impl::preInstall(void) const
        DEBUG("Success to pre-install stage.");
 }
 
-int AppCustomTrustAnchor::Impl::install(bool withSystemCerts) noexcept
+int TrustAnchor::Impl::install(bool withSystemCerts) noexcept
 {
        EXCEPTION_GUARD_START
 
@@ -193,13 +193,13 @@ int AppCustomTrustAnchor::Impl::install(bool withSystemCerts) noexcept
        EXCEPTION_GUARD_END
 }
 
-int AppCustomTrustAnchor::Impl::uninstall(bool isRollback) noexcept
+int TrustAnchor::Impl::uninstall(bool isRollback) noexcept
 {
        EXCEPTION_GUARD_START
 
        runtime::File customBaseDir(this->m_customBasePath);
        if (!customBaseDir.exists() && !isRollback)
-               throw std::invalid_argument("There is no installed acta previous.");
+               throw std::invalid_argument("There is no installed anchor previous.");
 
        if (customBaseDir.exists())
                customBaseDir.remove(true);
@@ -210,7 +210,7 @@ int AppCustomTrustAnchor::Impl::uninstall(bool isRollback) noexcept
        EXCEPTION_GUARD_END
 }
 
-bool AppCustomTrustAnchor::Impl::isSystemCertsModified(void) const
+bool TrustAnchor::Impl::isSystemCertsModified(void) const
 {
        struct stat systemAttr, customAttr;
 
@@ -224,7 +224,7 @@ bool AppCustomTrustAnchor::Impl::isSystemCertsModified(void) const
        return systemAttr.st_mtime > customAttr.st_mtime;
 }
 
-int AppCustomTrustAnchor::Impl::launch(bool withSystemCerts)
+int TrustAnchor::Impl::launch(bool withSystemCerts)
 {
        EXCEPTION_GUARD_START
 
@@ -262,7 +262,7 @@ int AppCustomTrustAnchor::Impl::launch(bool withSystemCerts)
        EXCEPTION_GUARD_END
 }
 
-std::string AppCustomTrustAnchor::Impl::getUniqueHashName(
+std::string TrustAnchor::Impl::getUniqueHashName(
        const std::string &hashName) const
 {
        int sameFileNameCnt = 0;
@@ -275,7 +275,7 @@ std::string AppCustomTrustAnchor::Impl::getUniqueHashName(
        return uniqueName;
 }
 
-void AppCustomTrustAnchor::Impl::makeCustomBundle(bool withSystemCerts)
+void TrustAnchor::Impl::makeCustomBundle(bool withSystemCerts)
 {
        runtime::File customBundle(this->m_customBundlePath + "/" +
                                                           BUNDLE_NAME);
@@ -299,7 +299,7 @@ void AppCustomTrustAnchor::Impl::makeCustomBundle(bool withSystemCerts)
        DEBUG("Finish migrating previous bundle.");
 
        if (this->m_customCertsData.empty()) {
-               DEBUG("System certificates is changed after ACTA installation.");
+               DEBUG("System certificates is changed after TrustAnchor installation.");
                runtime::DirectoryIterator iter(this->m_appCertsPath), end;
                while (iter != end) {
                        Certificate cert(iter->getPath());
@@ -318,18 +318,18 @@ void AppCustomTrustAnchor::Impl::makeCustomBundle(bool withSystemCerts)
        INFO("Success to make app custom bundle.");
 }
 
-AppCustomTrustAnchor::AppCustomTrustAnchor(const std::string &packageId,
-                                                                                  const std::string &certsDir,
-                                                                                  uid_t uid) noexcept :
+TrustAnchor::TrustAnchor(const std::string &packageId,
+                                                const std::string &certsDir,
+                                                uid_t uid) noexcept :
        m_pImpl(new Impl(packageId, certsDir, uid)) {}
 
-AppCustomTrustAnchor::AppCustomTrustAnchor(const std::string &packageId,
+TrustAnchor::TrustAnchor(const std::string &packageId,
                                                                                   const std::string &certsDir) noexcept :
        m_pImpl(new Impl(packageId, certsDir)) {}
 
-AppCustomTrustAnchor::~AppCustomTrustAnchor(void) = default;
+TrustAnchor::~TrustAnchor(void) = default;
 
-int AppCustomTrustAnchor::install(bool withSystemCerts) noexcept
+int TrustAnchor::install(bool withSystemCerts) noexcept
 {
        if (this->m_pImpl == nullptr)
                return -1;
@@ -344,7 +344,7 @@ int AppCustomTrustAnchor::install(bool withSystemCerts) noexcept
        return ret;
 }
 
-int AppCustomTrustAnchor::uninstall(void) noexcept
+int TrustAnchor::uninstall(void) noexcept
 {
        if (this->m_pImpl == nullptr)
                return -1;
@@ -352,7 +352,7 @@ int AppCustomTrustAnchor::uninstall(void) noexcept
        return this->m_pImpl->uninstall();
 }
 
-int AppCustomTrustAnchor::launch(bool withSystemCerts) noexcept
+int TrustAnchor::launch(bool withSystemCerts) noexcept
 {
        if (this->m_pImpl == nullptr)
                return -1;
similarity index 61%
rename from src/transec/AppCustomTrustAnchor.h
rename to src/transec/TrustAnchor.h
index c9e1c92..ee2bd9c 100644 (file)
  *    limitations under the License.
  */
 /*
- * @file        AppCustomTrustAnchor.h
+ * @file        TrustAnchor.h
  * @author      Sangwan Kwon (sangwan.kwon@samsung.com)
  * @version     0.1
- * @brief       App custom trust anchor C++ API header
+ * @brief       Trust anchor C++ API header
  */
 #pragma once
 
 
 namespace transec {
 
-class AppCustomTrustAnchor {
+class TrustAnchor {
 public:
-       explicit AppCustomTrustAnchor(const std::string &packageId,
-                                                                 const std::string &certsDir,
-                                                                 uid_t uid) noexcept;
-       explicit AppCustomTrustAnchor(const std::string &packageId,
-                                                                 const std::string &certsDir) noexcept;
-       virtual ~AppCustomTrustAnchor(void);
+       explicit TrustAnchor(const std::string &packageId,
+                                                const std::string &certsDir,
+                                                uid_t uid) noexcept;
+       explicit TrustAnchor(const std::string &packageId,
+                                                const std::string &certsDir) noexcept;
+       virtual ~TrustAnchor(void);
 
-       AppCustomTrustAnchor(const AppCustomTrustAnchor &) = delete;
-       AppCustomTrustAnchor(AppCustomTrustAnchor &&) = delete;
-       AppCustomTrustAnchor &operator=(const AppCustomTrustAnchor &) = delete;
-       AppCustomTrustAnchor &operator=(AppCustomTrustAnchor &&) = delete;
+       TrustAnchor(const TrustAnchor &) = delete;
+       TrustAnchor(TrustAnchor &&) = delete;
+       TrustAnchor &operator=(const TrustAnchor &) = delete;
+       TrustAnchor &operator=(TrustAnchor &&) = delete;
 
        int install(bool withSystemCerts) noexcept;
        int uninstall(void) noexcept;
diff --git a/src/transec/acta/app-custom-trust-anchor.h b/src/transec/acta/app-custom-trust-anchor.h
deleted file mode 100644 (file)
index 810e172..0000000
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- */
-
-
-/**
- * @file app-custom-trust-anchor.h
- * @brief App custom trust anchor CAPI header.
- */
-
-
-#ifndef APP_CUSTOM_TRUST_ANCHOR_H
-#define APP_CUSTOM_TRUST_ANCHOR_H
-
-
-#include <stddef.h>
-#include <sys/types.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/**
- * @brief Install app custom trust anchor for global app.
- * @details App custom certificates would be installed on system.
- *          This function should be called before acta_global_launch().
- * @param[in] package_id Global package id
- * @param[in] app_certificates_path App custom certificates path
- * @param[in] with_system_certificates Whether system certificates use or not
- * @return #ACTA_ERROR_NONE on success,
- *         negative on error
- * @retval #ACTA_ERROR_NONE Successful
- * @retval #ACTA_ERROR_OUT_OF_MEMORY Out of memory error
- * @retval #ACTA_ERROR_INTERNAL Internal error
- * @see acta_global_launch()
- * @see acta_global_uninstall()
- */
-int acta_global_install(const char *package_id,
-                                               const char *app_certificates_path,
-                                               bool with_system_certificates);
-
-
-/**
- * @brief Install app custom trust anchor for user app.
- * @details App custom certificates would be installed on system.
- *          This function should be called before acta_usr_launch().
- * @param[in] package_id User package id
- * @param[in] app_certificates_path App custom certificates path
- * @param[in] uid user id
- * @param[in] with_system_certificates Whether system certificates use or not
- * @return #ACTA_ERROR_NONE on success,
- *         negative on error
- * @retval #ACTA_ERROR_NONE Successful
- * @retval #ACTA_ERROR_OUT_OF_MEMORY Out of memory error
- * @retval #ACTA_ERROR_INTERNAL Internal error
- * @see acta_usr_launch()
- * @see acta_usr_uninstall()
- */
-int acta_usr_install(const char *package_id,
-                                        const char *app_certificates_path,
-                                        uid_t uid,
-                                        bool with_system_certificates);
-
-
-/**
- * @brief Launch app custom trust anchor for global app.
- * @details After lauching app custom trust anchor, app can use custom certificates.
- * @param[in] package_id Global package id
- * @param[in] app_certificates_path App custom certificates path
- * @param[in] with_system_certificates Whether system certificates use or not
- * @return #ACTA_ERROR_NONE on success,
- *         negative on error
- * @retval #ACTA_ERROR_NONE Successful
- * @retval #ACTA_ERROR_OUT_OF_MEMORY Out of memory error
- * @retval #ACTA_ERROR_INTERNAL Internal error
- * @see acta_global_install()
- */
-int acta_global_launch(const char *package_id,
-                                          const char *app_certificates_path,
-                                          bool with_system_certificates);
-
-
-/**
- * @brief Launch app custom trust anchor for user app.
- * @details After lauching app custom trust anchor, app can use custom certificates.
- * @param[in] package_id User package id
- * @param[in] app_certificates_path App custom certificates path
- * @param[in] with_system_certificates Whether system certificates use or not
- * @return #ACTA_ERROR_NONE on success,
- *         negative on error
- * @retval #ACTA_ERROR_NONE Successful
- * @retval #ACTA_ERROR_OUT_OF_MEMORY Out of memory error
- * @retval #ACTA_ERROR_INTERNAL Internal error
- * @see acta_global_install()
- */
-int acta_usr_launch(const char *package_id,
-                                       const char *app_certificates_path,
-                                       uid_t uid,
-                                       bool with_system_certificates);
-
-
-/**
- * @brief Uninstall app custom trust anchor for global app.
- * @param[in] package_id Global package id
- * @param[in] app_certificates_path App custom certificates path
- * @return #ACTA_ERROR_NONE on success,
- *         negative on error
- * @retval #ACTA_ERROR_NONE Successful
- * @retval #ACTA_ERROR_OUT_OF_MEMORY Out of memory error
- * @retval #ACTA_ERROR_INTERNAL Internal error
- * @see acta_global_install()
- */
-int acta_global_uninstall(const char *package_id,
-                                                 const char *app_certificates_path);
-
-
-/**
- * @brief Uninstall app custom trust anchor for user app.
- * @param[in] package_id User package id
- * @param[in] app_certificates_path App custom certificates path
- * @return #ACTA_ERROR_NONE on success,
- *         negative on error
- * @retval #ACTA_ERROR_NONE Successful
- * @retval #ACTA_ERROR_OUT_OF_MEMORY Out of memory error
- * @retval #ACTA_ERROR_INTERNAL Internal error
- * @see acta_usr_install()
- */
-int acta_usr_uninstall(const char *package_id,
-                                          const char *app_certificates_path,
-                                          uid_t uid);
-
-
-#ifdef __cplusplus
-} /* extern */
-#endif
-
-
-#endif /* APP_CUSTOM_TRUST_ANCHOR_H */
similarity index 66%
rename from src/transec/acta/acta-error.h
rename to src/transec/tanchor/error.h
index 5089b69..d91264e 100644 (file)
 
 
 /**
- * @file acta_error.h
+ * @file error.h
  * @brief Error enums and defines.
  */
 
 
-#ifndef ACTA_ERROR_H
-#define ACTA_ERROR_H
+#ifndef TRUST_ANCHOR_ERROR_H
+#define TRUST_ANCHOR_ERROR_H
 
 
 #include <errno.h>
@@ -33,18 +33,18 @@ extern "C" {
 #endif
 
 
-#define ACTA_ERROR_BASE -0x01000000
+#define TRUST_ANCHOR_ERROR_BASE -0x01000000
 
 
 /**
- * @brief Enumeration for ACTA error values.
+ * @brief Enumeration for trust anchor error values.
  */
 typedef enum {
-       ACTA_ERROR_NONE = 0,
-       ACTA_ERROR_INVALID_PARAMETER = -EINVAL,
-       ACTA_ERROR_OUT_OF_MEMORY = -ENOMEM,
-       ACTA_ERROR_INTERNAL = ACTA_ERROR_BASE | 0x01
-} acta_error_e;
+       TRUST_ANCHOR_ERROR_NONE = 0,
+       TRUST_ANCHOR_ERROR_INVALID_PARAMETER = -EINVAL,
+       TRUST_ANCHOR_ERROR_OUT_OF_MEMORY = -ENOMEM,
+       TRUST_ANCHOR_ERROR_INTERNAL = TRUST_ANCHOR_ERROR_BASE | 0x01
+} trust_anchor_error_e;
 
 
 #ifdef __cplusplus
@@ -52,4 +52,4 @@ typedef enum {
 #endif
 
 
-#endif /* ACTA_ERROR_H */
+#endif /* TRUST_ANCHOR_ERROR_H */
diff --git a/src/transec/tanchor/trust-anchor.h b/src/transec/tanchor/trust-anchor.h
new file mode 100644 (file)
index 0000000..274efbb
--- /dev/null
@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+
+
+/**
+ * @file trust-anchor.h
+ * @brief Trust anchor CAPI header
+ */
+
+
+#ifndef TRUST_ANCHOR_H
+#define TRUST_ANCHOR_H
+
+
+#include <stddef.h>
+#include <sys/types.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/**
+ * @brief Install trust anchor for global app.
+ * @details App custom certificates would be installed on system.
+ *          This function should be called before trust_anchor_global_launch().
+ * @param[in] package_id Global package id
+ * @param[in] app_certificates_path App custom certificates path
+ * @param[in] with_system_certificates Whether system certificates use or not
+ * @return #TRUST_ANCHOR_ERROR_NONE on success,
+ *         negative on error
+ * @retval #TRUST_ANCHOR_ERROR_NONE Successful
+ * @retval #TRUST_ANCHOR_ERROR_OUT_OF_MEMORY Out of memory error
+ * @retval #TRUST_ANCHOR_ERROR_INTERNAL Internal error
+ * @see trust_anchor_global_launch()
+ * @see trust_anchor_global_uninstall()
+ */
+int trust_anchor_global_install(const char *package_id,
+                                                               const char *app_certificates_path,
+                                                               bool with_system_certificates);
+
+
+/**
+ * @brief Install trust anchor for user app.
+ * @details App custom certificates would be installed on system.
+ *          This function should be called before trust_anchor_usr_launch().
+ * @param[in] package_id User package id
+ * @param[in] app_certificates_path App custom certificates path
+ * @param[in] uid user id
+ * @param[in] with_system_certificates Whether system certificates use or not
+ * @return #TRUST_ANCHOR_ERROR_NONE on success,
+ *         negative on error
+ * @retval #TRUST_ANCHOR_ERROR_NONE Successful
+ * @retval #TRUST_ANCHOR_ERROR_OUT_OF_MEMORY Out of memory error
+ * @retval #TRUST_ANCHOR_ERROR_INTERNAL Internal error
+ * @see trust_anchor_usr_launch()
+ * @see trust_anchor_usr_uninstall()
+ */
+int trust_anchor_usr_install(const char *package_id,
+                                                        const char *app_certificates_path,
+                                                        uid_t uid,
+                                                        bool with_system_certificates);
+
+
+/**
+ * @brief Launch trust anchor for global app.
+ * @details After lauching trust anchor, app can use custom certificates.
+ * @param[in] package_id Global package id
+ * @param[in] app_certificates_path App custom certificates path
+ * @param[in] with_system_certificates Whether system certificates use or not
+ * @return #TRUST_ANCHOR_ERROR_NONE on success,
+ *         negative on error
+ * @retval #TRUST_ANCHOR_ERROR_NONE Successful
+ * @retval #TRUST_ANCHOR_ERROR_OUT_OF_MEMORY Out of memory error
+ * @retval #TRUST_ANCHOR_ERROR_INTERNAL Internal error
+ * @see trust_anchor_global_install()
+ */
+int trust_anchor_global_launch(const char *package_id,
+                                                          const char *app_certificates_path,
+                                                          bool with_system_certificates);
+
+
+/**
+ * @brief Launch trust anchor for user app.
+ * @details After lauching trust anchor, app can use custom certificates.
+ * @param[in] package_id User package id
+ * @param[in] app_certificates_path App custom certificates path
+ * @param[in] with_system_certificates Whether system certificates use or not
+ * @return #TRUST_ANCHOR_ERROR_NONE on success,
+ *         negative on error
+ * @retval #TRUST_ANCHOR_ERROR_NONE Successful
+ * @retval #TRUST_ANCHOR_ERROR_OUT_OF_MEMORY Out of memory error
+ * @retval #TRUST_ANCHOR_ERROR_INTERNAL Internal error
+ * @see trust_anchor_global_install()
+ */
+int trust_anchor_usr_launch(const char *package_id,
+                                                       const char *app_certificates_path,
+                                                       uid_t uid,
+                                                       bool with_system_certificates);
+
+
+/**
+ * @brief Uninstall trust anchor for global app.
+ * @param[in] package_id Global package id
+ * @param[in] app_certificates_path App custom certificates path
+ * @return #TRUST_ANCHOR_ERROR_NONE on success,
+ *         negative on error
+ * @retval #TRUST_ANCHOR_ERROR_NONE Successful
+ * @retval #TRUST_ANCHOR_ERROR_OUT_OF_MEMORY Out of memory error
+ * @retval #TRUST_ANCHOR_ERROR_INTERNAL Internal error
+ * @see trust_anchor_global_install()
+ */
+int trust_anchor_global_uninstall(const char *package_id,
+                                                                 const char *app_certificates_path);
+
+
+/**
+ * @brief Uninstall trust anchor for user app.
+ * @param[in] package_id User package id
+ * @param[in] app_certificates_path App custom certificates path
+ * @return #TRUST_ANCHOR_ERROR_NONE on success,
+ *         negative on error
+ * @retval #TRUST_ANCHOR_ERROR_NONE Successful
+ * @retval #TRUST_ANCHOR_ERROR_OUT_OF_MEMORY Out of memory error
+ * @retval #TRUST_ANCHOR_ERROR_INTERNAL Internal error
+ * @see trust_anchor_usr_install()
+ */
+int trust_anchor_usr_uninstall(const char *package_id,
+                                                          const char *app_certificates_path,
+                                                          uid_t uid);
+
+
+#ifdef __cplusplus
+} /* extern */
+#endif
+
+
+#endif /* TRUST_ANCHOR_H */
index 90101d8..8d06282 100644 (file)
@@ -21,8 +21,8 @@ SET(TEST_SRCS
        test-util.cpp
        test-capi-installer.cpp
        test-capi-launcher.cpp
-       test-acta-installer.cpp
-       test-acta-launcher.cpp
+       test-installer.cpp
+       test-launcher.cpp
        test-certificate.cpp
 )
 
diff --git a/tests/transec/test-acta-installer.cpp b/tests/transec/test-acta-installer.cpp
deleted file mode 100644 (file)
index 580b98a..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- */
-/*
- * @file        test-acta-installer.cpp
- * @author      Sangwan Kwon (sangwan.kwon@samsung.com)
- * @version     0.1
- * @brief       Unit test program of ACTA for installer
- */
-
-#include <dpl/test/test_runner.h>
-
-#include <AppCustomTrustAnchor.h>
-
-#include <sched.h>
-#include <unistd.h>
-
-#include <iostream>
-
-#include "test-resource.h"
-
-RUNNER_TEST_GROUP_INIT(T0400_API_ACTA_INSTALLER)
-
-using namespace transec;
-
-RUNNER_TEST(T0401_ACTA_INSTALL_GLOBAL_APP_POSITIVE)
-{
-       AppCustomTrustAnchor acta(DUMMY_PKG_ID, APP_CERTS_DIR);
-       int ret = acta.install(false);
-       RUNNER_ASSERT_MSG(ret == 0, "ACTA install should be success.");
-}
-
-RUNNER_TEST(T0402_ACTA_INSTALL_GLOBAL_APP_WITH_SYS_POSITIVE)
-{
-       AppCustomTrustAnchor acta(DUMMY_PKG_ID, APP_CERTS_DIR);
-       int ret = acta.install(true);
-       RUNNER_ASSERT_MSG(ret == 0, "ACTA install should be success.");
-}
-
-RUNNER_TEST(T0403_ACTA_INSTALL_USER_APP_POSITIVE)
-{
-       AppCustomTrustAnchor acta(DUMMY_PKG_ID, APP_CERTS_DIR, DUMMY_UID);
-       int ret = acta.install(false);
-       RUNNER_ASSERT_MSG(ret == 0, "ACTA install should be success.");
-}
-
-RUNNER_TEST(T0404_ACTA_INSTALL_USER_APP_WITH_SYS_POSITIVE)
-{
-       AppCustomTrustAnchor acta(DUMMY_PKG_ID, APP_CERTS_DIR, DUMMY_UID);
-       int ret = acta.install(true);
-       RUNNER_ASSERT_MSG(ret == 0, "ACTA install should be success.");
-}
-
-RUNNER_TEST(T0405_ACTA_INSTALL_GLOBAL_APP_NEGATIVE)
-{
-       AppCustomTrustAnchor acta(DUMMY_PKG_ID, DUMMY_CERTS_DIR);
-       int ret = acta.install(false);
-       RUNNER_ASSERT_MSG(ret != 0, "ACTA install should be fail.");
-}
-
-RUNNER_TEST(T0406_ACTA_INSTALL_GLOBAL_APP_WITH_SYS_NEGATIVE)
-{
-       AppCustomTrustAnchor acta(DUMMY_PKG_ID, DUMMY_CERTS_DIR);
-       int ret = acta.install(true);
-       RUNNER_ASSERT_MSG(ret != 0, "ACTA install should be fail.");
-}
-
-RUNNER_TEST(T0407_ACTA_INSTALL_USER_APP_NEGATIVE)
-{
-       AppCustomTrustAnchor acta(DUMMY_PKG_ID, DUMMY_CERTS_DIR, DUMMY_UID);
-       int ret = acta.install(false);
-       RUNNER_ASSERT_MSG(ret != 0, "ACTA install should be fail.");
-}
-
-RUNNER_TEST(T0408_ACTA_INSTALL_USER_APP_WITH_SYS_NEGATIVE)
-{
-       AppCustomTrustAnchor acta(DUMMY_PKG_ID, DUMMY_CERTS_DIR, DUMMY_UID);
-       int ret = acta.install(true);
-       RUNNER_ASSERT_MSG(ret != 0, "ACTA install should be fail.");
-}
-
-RUNNER_TEST(T0421_ACTA_UNINSTALL_GLOBAL_APP_POSITIVE)
-{
-       AppCustomTrustAnchor acta(DUMMY_PKG_ID, APP_CERTS_DIR);
-       int ret = acta.install(false);
-       RUNNER_ASSERT_MSG(ret == 0, "ACTA install should be success.");
-
-       ret = acta.uninstall();
-       RUNNER_ASSERT_MSG(ret == 0, "ACTA uninstall should be success.");
-}
-
-RUNNER_TEST(T0422_ACTA_UNINSTALL_USER_APP_POSITIVE)
-{
-       AppCustomTrustAnchor acta(DUMMY_PKG_ID, APP_CERTS_DIR, DUMMY_UID);
-       int ret = acta.install(false);
-       RUNNER_ASSERT_MSG(ret == 0, "ACTA install should be success.");
-
-       ret = acta.uninstall();
-       RUNNER_ASSERT_MSG(ret == 0, "ACTA uninstall should be success.");
-}
-
-RUNNER_TEST(T0423_ACTA_UNINSTALL_GLOBAL_APP_NEGATIVE)
-{
-       AppCustomTrustAnchor acta(DUMMY_PKG_ID, DUMMY_CERTS_DIR);
-       int ret = acta.uninstall();
-       RUNNER_ASSERT_MSG(ret != 0, "ACTA uninstall should be fail.");
-}
-
-RUNNER_TEST(T0424_ACTA_UNINSTALL_USER_APP_NEGATIVE)
-{
-       AppCustomTrustAnchor acta(DUMMY_PKG_ID, DUMMY_CERTS_DIR, DUMMY_UID);
-       int ret = acta.uninstall();
-       RUNNER_ASSERT_MSG(ret != 0, "ACTA uninstall should be fail.");
-}
index 775c29c..4dae1f0 100644 (file)
  * @file        test-capi-installer.cpp
  * @author      Sangwan Kwon (sangwan.kwon@samsung.com)
  * @version     0.1
- * @brief       Unit test program of ACTA CAPI for installer
+ * @brief       Unit test program of Trust Anchor CAPI for installer
  */
 
 #include <dpl/test/test_runner.h>
 
-#include "acta/app-custom-trust-anchor.h"
+#include "tanchor/trust-anchor.h"
 
 #include "test-resource.h"
 
-RUNNER_TEST_GROUP_INIT(T0800_CAPI_ACTA_INSTALLER)
+RUNNER_TEST_GROUP_INIT(T0800_CAPI_TRUST_ANCHOR_INSTALLER)
 
-RUNNER_TEST(T0801_CAPI_ACTA_INSTALL_GLOBAL_APP_POSITIVE)
+RUNNER_TEST(T0801_CAPI_TRUST_ANCHOR_INSTALL_GLOBAL_APP_POSITIVE)
 {
-       int ret = acta_global_install(DUMMY_PKG_ID, APP_CERTS_DIR, false);
-       RUNNER_ASSERT_MSG(ret == 0, "ACTA install should be success.");
+       int ret = trust_anchor_global_install(DUMMY_PKG_ID, APP_CERTS_DIR, false);
+       RUNNER_ASSERT_MSG(ret == 0, "Trust Anchor install should be success.");
 }
 
-RUNNER_TEST(T0802_CAPI_ACTA_INSTALL_GLOBAL_APP_WITH_SYS_POSITIVE)
+RUNNER_TEST(T0802_CAPI_TRUST_ANCHOR_INSTALL_GLOBAL_APP_WITH_SYS_POSITIVE)
 {
-       int ret = acta_global_install(DUMMY_PKG_ID, APP_CERTS_DIR, true);
-       RUNNER_ASSERT_MSG(ret == 0, "ACTA install should be success.");
+       int ret = trust_anchor_global_install(DUMMY_PKG_ID, APP_CERTS_DIR, true);
+       RUNNER_ASSERT_MSG(ret == 0, "Trust Anchor install should be success.");
 }
 
-RUNNER_TEST(T0803_CAPI_ACTA_INSTALL_USER_APP_POSITIVE)
+RUNNER_TEST(T0803_CAPI_TRUST_ANCHOR_INSTALL_USER_APP_POSITIVE)
 {
-       int ret = acta_usr_install(DUMMY_PKG_ID, APP_CERTS_DIR, DUMMY_UID, false);
-       RUNNER_ASSERT_MSG(ret == 0, "ACTA install should be success.");
+       int ret = trust_anchor_usr_install(DUMMY_PKG_ID, APP_CERTS_DIR, DUMMY_UID, false);
+       RUNNER_ASSERT_MSG(ret == 0, "Trust Anchor install should be success.");
 }
 
-RUNNER_TEST(T0804_CAPI_ACTA_INSTALL_USER_APP_WITH_SYS_POSITIVE)
+RUNNER_TEST(T0804_CAPI_TRUST_ANCHOR_INSTALL_USER_APP_WITH_SYS_POSITIVE)
 {
-       int ret = acta_usr_install(DUMMY_PKG_ID, APP_CERTS_DIR, DUMMY_UID, true);
-       RUNNER_ASSERT_MSG(ret == 0, "ACTA install should be success.");
+       int ret = trust_anchor_usr_install(DUMMY_PKG_ID, APP_CERTS_DIR, DUMMY_UID, true);
+       RUNNER_ASSERT_MSG(ret == 0, "Trust Anchor install should be success.");
 }
 
-RUNNER_TEST(T0805_CAPI_ACTA_INSTALL_GLOBAL_APP_NEGATIVE)
+RUNNER_TEST(T0805_CAPI_TRUST_ANCHOR_INSTALL_GLOBAL_APP_NEGATIVE)
 {
-       int ret = acta_global_install(DUMMY_PKG_ID, DUMMY_CERTS_DIR, false);
-       RUNNER_ASSERT_MSG(ret != 0, "ACTA install should be fail.");
+       int ret = trust_anchor_global_install(DUMMY_PKG_ID, DUMMY_CERTS_DIR, false);
+       RUNNER_ASSERT_MSG(ret != 0, "Trust Anchor install should be fail.");
 }
 
-RUNNER_TEST(T0806_CAPI_ACTA_INSTALL_GLOBAL_APP_WITH_SYS_NEGATIVE)
+RUNNER_TEST(T0806_CAPI_TRUST_ANCHOR_INSTALL_GLOBAL_APP_WITH_SYS_NEGATIVE)
 {
-       int ret = acta_global_install(DUMMY_PKG_ID, DUMMY_CERTS_DIR, true);
-       RUNNER_ASSERT_MSG(ret != 0, "ACTA install should be fail.");
+       int ret = trust_anchor_global_install(DUMMY_PKG_ID, DUMMY_CERTS_DIR, true);
+       RUNNER_ASSERT_MSG(ret != 0, "Trust Anchor install should be fail.");
 }
 
-RUNNER_TEST(T0807_CAPI_ACTA_INSTALL_USER_APP_NEGATIVE)
+RUNNER_TEST(T0807_CAPI_TRUST_ANCHOR_INSTALL_USER_APP_NEGATIVE)
 {
-       int ret = acta_usr_install(DUMMY_PKG_ID, DUMMY_CERTS_DIR, DUMMY_UID, false);
-       RUNNER_ASSERT_MSG(ret != 0, "ACTA install should be fail.");
+       int ret = trust_anchor_usr_install(DUMMY_PKG_ID, DUMMY_CERTS_DIR, DUMMY_UID, false);
+       RUNNER_ASSERT_MSG(ret != 0, "Trust Anchor install should be fail.");
 }
 
-RUNNER_TEST(T0808_CAPI_ACTA_INSTALL_USER_APP_WITH_SYS_NEGATIVE)
+RUNNER_TEST(T0808_CAPI_TRUST_ANCHOR_INSTALL_USER_APP_WITH_SYS_NEGATIVE)
 {
-       int ret = acta_usr_install(DUMMY_PKG_ID, DUMMY_CERTS_DIR, DUMMY_UID, true);
-       RUNNER_ASSERT_MSG(ret != 0, "ACTA install should be fail.");
+       int ret = trust_anchor_usr_install(DUMMY_PKG_ID, DUMMY_CERTS_DIR, DUMMY_UID, true);
+       RUNNER_ASSERT_MSG(ret != 0, "Trust Anchor install should be fail.");
 }
 
-RUNNER_TEST(T0821_CAPI_ACTA_UNINSTALL_GLOBAL_APP_POSITIVE)
+RUNNER_TEST(T0821_CAPI_TRUST_ANCHOR_UNINSTALL_GLOBAL_APP_POSITIVE)
 {
-       int ret = acta_global_install(DUMMY_PKG_ID, APP_CERTS_DIR, false);
-       RUNNER_ASSERT_MSG(ret == 0, "ACTA install should be success.");
+       int ret = trust_anchor_global_install(DUMMY_PKG_ID, APP_CERTS_DIR, false);
+       RUNNER_ASSERT_MSG(ret == 0, "Trust Anchor install should be success.");
 
-       ret = acta_global_uninstall(DUMMY_PKG_ID, APP_CERTS_DIR);
-       RUNNER_ASSERT_MSG(ret == 0, "ACTA uninstall should be success.");
+       ret = trust_anchor_global_uninstall(DUMMY_PKG_ID, APP_CERTS_DIR);
+       RUNNER_ASSERT_MSG(ret == 0, "Trust Anchor uninstall should be success.");
 }
 
-RUNNER_TEST(T0822_CAPI_ACTA_UNINSTALL_USER_APP_POSITIVE)
+RUNNER_TEST(T0822_CAPI_TRUST_ANCHOR_UNINSTALL_USER_APP_POSITIVE)
 {
-       int ret = acta_usr_install(DUMMY_PKG_ID, APP_CERTS_DIR, DUMMY_UID, false);
-       RUNNER_ASSERT_MSG(ret == 0, "ACTA install should be success.");
+       int ret = trust_anchor_usr_install(DUMMY_PKG_ID, APP_CERTS_DIR, DUMMY_UID, false);
+       RUNNER_ASSERT_MSG(ret == 0, "Trust Anchor install should be success.");
 
-       ret = acta_usr_uninstall(DUMMY_PKG_ID, APP_CERTS_DIR, DUMMY_UID);
-       RUNNER_ASSERT_MSG(ret == 0, "ACTA uninstall should be success.");
+       ret = trust_anchor_usr_uninstall(DUMMY_PKG_ID, APP_CERTS_DIR, DUMMY_UID);
+       RUNNER_ASSERT_MSG(ret == 0, "Trust Anchor uninstall should be success.");
 }
 
-RUNNER_TEST(T0823_CAPI_ACTA_UNINSTALL_GLOBAL_APP_NEGATIVE)
+RUNNER_TEST(T0823_CAPI_TRUST_ANCHOR_UNINSTALL_GLOBAL_APP_NEGATIVE)
 {
-       int ret = acta_global_uninstall(DUMMY_PKG_ID, DUMMY_CERTS_DIR);
-       RUNNER_ASSERT_MSG(ret != 0, "ACTA uninstall should be fail.");
+       int ret = trust_anchor_global_uninstall(DUMMY_PKG_ID, DUMMY_CERTS_DIR);
+       RUNNER_ASSERT_MSG(ret != 0, "Trust Anchor uninstall should be fail.");
 }
 
-RUNNER_TEST(T0824_CAPI_ACTA_UNINSTALL_USER_APP_NEGATIVE)
+RUNNER_TEST(T0824_CAPI_TRUST_ANCHOR_UNINSTALL_USER_APP_NEGATIVE)
 {
-       int ret = acta_usr_uninstall(DUMMY_PKG_ID, DUMMY_CERTS_DIR, DUMMY_UID);
-       RUNNER_ASSERT_MSG(ret != 0, "ACTA uninstall should be fail.");
+       int ret = trust_anchor_usr_uninstall(DUMMY_PKG_ID, DUMMY_CERTS_DIR, DUMMY_UID);
+       RUNNER_ASSERT_MSG(ret != 0, "Trust Anchor uninstall should be fail.");
 }
index 5b4e4b6..a941078 100644 (file)
  * @file        test-capi-launcher.cpp
  * @author      Sangwan Kwon (sangwan.kwon@samsung.com)
  * @version     0.1
- * @brief       Unit test program of ACTA for launcher
+ * @brief       Unit test program of Trust Anchor for launcher
  */
 
 #include <dpl/test/test_runner.h>
 
-#include <acta/app-custom-trust-anchor.h>
+#include <tanchor/trust-anchor.h>
 
 #include <unistd.h>
 
 #include "test-util.h"
 #include "test-resource.h"
 
-RUNNER_TEST_GROUP_INIT(T0500_CAPI_ACTA_LAUNCER)
+RUNNER_TEST_GROUP_INIT(T0500_CAPI_TRUST_ANCHOR_LAUNCER)
 
 // Launch needs CAP_SYS_ADMIN
-RUNNER_TEST(T0501_ACTA_LAUNCH)
+RUNNER_TEST(T0501_TRUST_ANCHOR_LAUNCH)
 {
        auto beforeLs = test::util::ls(TZ_SYS_RO_CA_CERTS);
        auto beforeCat = test::util::cat(TZ_SYS_RO_CA_BUNDLE);
 
-       int ret = acta_global_install(DUMMY_PKG_ID, APP_CERTS_DIR, true);
+       int ret = trust_anchor_global_install(DUMMY_PKG_ID, APP_CERTS_DIR, true);
 
        // pre-condition
        int pid = fork();
 
        if (pid == 0) {
-               ret = acta_global_launch(DUMMY_PKG_ID, APP_CERTS_DIR, true);
-               RUNNER_ASSERT_MSG(ret == 0, "ACTA launch should be success.");
+               ret = trust_anchor_global_launch(DUMMY_PKG_ID, APP_CERTS_DIR, true);
+               RUNNER_ASSERT_MSG(ret == 0, "Trust Anchor launch should be success.");
 
                auto afterLsChild = test::util::ls(TZ_SYS_RO_CA_CERTS);
                RUNNER_ASSERT_MSG(beforeLs != afterLsChild, "Failed to launch.");
diff --git a/tests/transec/test-installer.cpp b/tests/transec/test-installer.cpp
new file mode 100644 (file)
index 0000000..b7398d7
--- /dev/null
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+/*
+ * @file        test-installer.cpp
+ * @author      Sangwan Kwon (sangwan.kwon@samsung.com)
+ * @version     0.1
+ * @brief       Unit test program of Trust Anchor for installer
+ */
+
+#include <dpl/test/test_runner.h>
+
+#include <TrustAnchor.h>
+
+#include <sched.h>
+#include <unistd.h>
+
+#include <iostream>
+
+#include "test-resource.h"
+
+RUNNER_TEST_GROUP_INIT(T0400_API_TRUST_ANCHOR_INSTALLER)
+
+using namespace transec;
+
+RUNNER_TEST(T0401_TRUST_ANCHOR_INSTALL_GLOBAL_APP_POSITIVE)
+{
+       TrustAnchor ta(DUMMY_PKG_ID, APP_CERTS_DIR);
+       int ret = ta.install(false);
+       RUNNER_ASSERT_MSG(ret == 0, "TA install should be success.");
+}
+
+RUNNER_TEST(T0402_TRUST_ANCHOR_INSTALL_GLOBAL_APP_WITH_SYS_POSITIVE)
+{
+       TrustAnchor ta(DUMMY_PKG_ID, APP_CERTS_DIR);
+       int ret = ta.install(true);
+       RUNNER_ASSERT_MSG(ret == 0, "TA install should be success.");
+}
+
+RUNNER_TEST(T0403_TRUST_ANCHOR_INSTALL_USER_APP_POSITIVE)
+{
+       TrustAnchor ta(DUMMY_PKG_ID, APP_CERTS_DIR, DUMMY_UID);
+       int ret = ta.install(false);
+       RUNNER_ASSERT_MSG(ret == 0, "TA install should be success.");
+}
+
+RUNNER_TEST(T0404_TRUST_ANCHOR_INSTALL_USER_APP_WITH_SYS_POSITIVE)
+{
+       TrustAnchor ta(DUMMY_PKG_ID, APP_CERTS_DIR, DUMMY_UID);
+       int ret = ta.install(true);
+       RUNNER_ASSERT_MSG(ret == 0, "TA install should be success.");
+}
+
+RUNNER_TEST(T0405_TRUST_ANCHOR_INSTALL_GLOBAL_APP_NEGATIVE)
+{
+       TrustAnchor ta(DUMMY_PKG_ID, DUMMY_CERTS_DIR);
+       int ret = ta.install(false);
+       RUNNER_ASSERT_MSG(ret != 0, "TA install should be fail.");
+}
+
+RUNNER_TEST(T0406_TRUST_ANCHOR_INSTALL_GLOBAL_APP_WITH_SYS_NEGATIVE)
+{
+       TrustAnchor ta(DUMMY_PKG_ID, DUMMY_CERTS_DIR);
+       int ret = ta.install(true);
+       RUNNER_ASSERT_MSG(ret != 0, "TA install should be fail.");
+}
+
+RUNNER_TEST(T0407_TRUST_ANCHOR_INSTALL_USER_APP_NEGATIVE)
+{
+       TrustAnchor ta(DUMMY_PKG_ID, DUMMY_CERTS_DIR, DUMMY_UID);
+       int ret = ta.install(false);
+       RUNNER_ASSERT_MSG(ret != 0, "TA install should be fail.");
+}
+
+RUNNER_TEST(T0408_TRUST_ANCHOR_INSTALL_USER_APP_WITH_SYS_NEGATIVE)
+{
+       TrustAnchor ta(DUMMY_PKG_ID, DUMMY_CERTS_DIR, DUMMY_UID);
+       int ret = ta.install(true);
+       RUNNER_ASSERT_MSG(ret != 0, "TA install should be fail.");
+}
+
+RUNNER_TEST(T0421_TRUST_ANCHOR_UNINSTALL_GLOBAL_APP_POSITIVE)
+{
+       TrustAnchor ta(DUMMY_PKG_ID, APP_CERTS_DIR);
+       int ret = ta.install(false);
+       RUNNER_ASSERT_MSG(ret == 0, "TA install should be success.");
+
+       ret = ta.uninstall();
+       RUNNER_ASSERT_MSG(ret == 0, "TA uninstall should be success.");
+}
+
+RUNNER_TEST(T0422_TRUST_ANCHOR_UNINSTALL_USER_APP_POSITIVE)
+{
+       TrustAnchor ta(DUMMY_PKG_ID, APP_CERTS_DIR, DUMMY_UID);
+       int ret = ta.install(false);
+       RUNNER_ASSERT_MSG(ret == 0, "TA install should be success.");
+
+       ret = ta.uninstall();
+       RUNNER_ASSERT_MSG(ret == 0, "TA uninstall should be success.");
+}
+
+RUNNER_TEST(T0423_TRUST_ANCHOR_UNINSTALL_GLOBAL_APP_NEGATIVE)
+{
+       TrustAnchor ta(DUMMY_PKG_ID, DUMMY_CERTS_DIR);
+       int ret = ta.uninstall();
+       RUNNER_ASSERT_MSG(ret != 0, "TA uninstall should be fail.");
+}
+
+RUNNER_TEST(T0424_TRUST_ANCHOR_UNINSTALL_USER_APP_NEGATIVE)
+{
+       TrustAnchor ta(DUMMY_PKG_ID, DUMMY_CERTS_DIR, DUMMY_UID);
+       int ret = ta.uninstall();
+       RUNNER_ASSERT_MSG(ret != 0, "TA uninstall should be fail.");
+}
similarity index 80%
rename from tests/transec/test-acta-launcher.cpp
rename to tests/transec/test-launcher.cpp
index ec00fae..6b95660 100644 (file)
  *    limitations under the License.
  */
 /*
- * @file        test-actc-launcher.cpp
+ * @file        test-launcher.cpp
  * @author      Sangwan Kwon (sangwan.kwon@samsung.com)
  * @version     0.1
- * @brief       Unit test program of ACTA for launcher
+ * @brief       Unit test program of Trust Anchor for launcher
  */
 
 #include <dpl/test/test_runner.h>
 
-#include <AppCustomTrustAnchor.h>
+#include <TrustAnchor.h>
 
 #include <unistd.h>
 
 #include "test-util.h"
 #include "test-resource.h"
 
-RUNNER_TEST_GROUP_INIT(T0600_API_ACTA_LAUNCER)
+RUNNER_TEST_GROUP_INIT(T0600_API_TRUST_ANCHOR_LAUNCER)
 
 using namespace transec;
 
 // Launch needs CAP_SYS_ADMIN
-RUNNER_TEST(T0601_ACTA_LAUNCH)
+RUNNER_TEST(T0601_TRUST_ANCHOR_LAUNCH)
 {
        auto beforeLs = test::util::ls(TZ_SYS_RO_CA_CERTS);
        auto beforeCat = test::util::cat(TZ_SYS_RO_CA_BUNDLE);
 
-       AppCustomTrustAnchor acta(DUMMY_PKG_ID, APP_CERTS_DIR);
-       int ret = acta.install(true);
+       TrustAnchor ta(DUMMY_PKG_ID, APP_CERTS_DIR);
+       int ret = ta.install(true);
 
        // pre-condition
        int pid = fork();
 
        if (pid == 0) {
-               ret = acta.launch(true);
-               RUNNER_ASSERT_MSG(ret == 0, "ACTA launch should be success.");
+               ret = ta.launch(true);
+               RUNNER_ASSERT_MSG(ret == 0, "TA launch should be success.");
 
                auto afterLsChild = test::util::ls(TZ_SYS_RO_CA_CERTS);
                RUNNER_ASSERT_MSG(beforeLs != afterLsChild, "Failed to launch.");