Split client API into two parts(Control API and Store/Crypto API)
authoryuseok.jeon <yuseok.jeon@samsung.com>
Wed, 2 Jul 2014 02:36:15 +0000 (11:36 +0900)
committerBartlomiej Grzelewski <b.grzelewski@samsung.com>
Fri, 12 Sep 2014 12:58:49 +0000 (14:58 +0200)
Change-Id: I60d564a125a2bf493b941897d521ea9adae8a499
Signed-off-by: yuseok.jeon <yuseok.jeon@samsung.com>
CMakeLists.txt
build/key-manager.pc.in
packaging/key-manager.spec
packaging/libkey-manager-control-client.manifest [new file with mode: 0644]
src/CMakeLists.txt
src/include/ckm/key-manager-control.h [new file with mode: 0644]
src/include/ckm/key-manager.h
src/manager/client/client-control.cpp
src/manager/service/CryptoService.cpp [changed mode: 0755->0644]
src/manager/service/ckm-logic.cpp

index 56f727c..dc38ff6 100644 (file)
@@ -60,6 +60,7 @@ ENDIF (CMAKE_BUILD_TYPE MATCHES "DEBUG")
 
 SET(TARGET_KEY_MANAGER "key-manager")
 SET(TARGET_KEY_MANAGER_CLIENT "key-manager-client")
+SET(TARGET_KEY_MANAGER_CONTROL_CLIENT "key-manager-control-client")
 SET(TARGET_KEY_MANAGER_COMMON "key-manager-commons")
 SET(TARGET_KEY_MANAGER_KEY_PROVIDER "key-manager-key-provider")
 
@@ -67,6 +68,7 @@ SET(TARGET_TEST_MERGED "ckm-tests-internal")
 
 INSTALL(FILES
     ${CMAKE_SOURCE_DIR}/packaging/libkey-manager-client.manifest
+    ${CMAKE_SOURCE_DIR}/packaging/libkey-manager-control-client.manifest
     ${CMAKE_SOURCE_DIR}/packaging/key-manager.manifest
     DESTINATION
     /usr/share
index f516714..219eba7 100644 (file)
@@ -7,5 +7,5 @@ Name: key-manager
 Description: Central Key Manager Package
 Version: 1.0.1
 Requires: openssl libsmack
-Libs: -L${libdir} -lkey-manager-client -lsmack
+Libs: -L${libdir} -lkey-manager-client -lkey-manager-control-client -lsmack
 Cflags: -I${includedir}/ckm
index 3e492a7..69e1113 100644 (file)
@@ -78,6 +78,7 @@ rm -rf %{buildroot}
 mkdir -p %{buildroot}/usr/share/license
 cp LICENSE %{buildroot}/usr/share/license/%{name}
 cp LICENSE %{buildroot}/usr/share/license/libkey-manager-client
+cp LICENSE %{buildroot}/usr/share/license/libkey-manager-control-client
 mkdir -p %{buildroot}/etc/security/
 
 %make_install
@@ -147,16 +148,21 @@ fi
 
 %files -n libkey-manager-client
 %manifest %{_datadir}/libkey-manager-client.manifest
+%manifest %{_datadir}/libkey-manager-control-client.manifest
 %defattr(-,root,root,-)
 %{_libdir}/libkey-manager-client.so.*
+%{_libdir}/libkey-manager-control-client.so.*
 %{_datadir}/license/libkey-manager-client
+%{_datadir}/license/libkey-manager-control-client
 
 
 %files -n libkey-manager-client-devel
 %defattr(-,root,root,-)
 %{_libdir}/libkey-manager-client.so
+%{_libdir}/libkey-manager-control-client.so
 %{_libdir}/libkey-manager-commons.so
 %{_includedir}/ckm/ckm/key-manager.h
+%{_includedir}/ckm/ckm/key-manager-control.h
 %{_includedir}/ckm/ckm/ckm-error.h
 %{_includedir}/ckm/ckm/ckm-type.h
 %{_libdir}/pkgconfig/*.pc
diff --git a/packaging/libkey-manager-control-client.manifest b/packaging/libkey-manager-control-client.manifest
new file mode 100644 (file)
index 0000000..a76fdba
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+       <request>
+               <domain name="_" />
+       </request>
+</manifest>
index cf9ba24..9623012 100644 (file)
@@ -71,7 +71,6 @@ INCLUDE_DIRECTORIES(
 
 SET(KEY_MANAGER_CLIENT_SOURCES
     ${KEY_MANAGER_CLIENT_SRC_PATH}/client-certificate.cpp
-    ${KEY_MANAGER_CLIENT_SRC_PATH}/client-control.cpp
     ${KEY_MANAGER_CLIENT_SRC_PATH}/client-common.cpp
     ${KEY_MANAGER_CLIENT_SRC_PATH}/client-echo.cpp
     ${KEY_MANAGER_CLIENT_SRC_PATH}/client-error.cpp
@@ -97,13 +96,48 @@ TARGET_LINK_LIBRARIES(${TARGET_KEY_MANAGER_CLIENT}
 
 ################################################################################
 
+SET(KEY_MANAGER_CONTROL_CLIENT_VERSION_MAJOR 1)
+SET(KEY_MANAGER_CONTROL_CLIENT_VERSION ${KEY_MANAGER_CONTROL_CLIENT_VERSION_MAJOR}.0.1)
+
+SET(KEY_MANAGER_CONTROL_CLIENT_SRC_PATH ${KEY_MANAGER_PATH}/client)
+
+INCLUDE_DIRECTORIES(
+    ${KEY_MANAGER_PATH}/client
+    ${KEY_MANAGER_PATH}/common
+    ${KEY_MANAGER_PATH}/dpl/core/include
+    ${KEY_MANAGER_PATH}/dpl/log/include
+    )
+
+SET(KEY_MANAGER_CONTROL_CLIENT_SOURCES
+    ${KEY_MANAGER_CONTROL_CLIENT_SRC_PATH}/client-control.cpp
+    ${KEY_MANAGER_CONTROL_CLIENT_SRC_PATH}/client-common.cpp
+    )
+
+ADD_LIBRARY(${TARGET_KEY_MANAGER_CONTROL_CLIENT} SHARED ${KEY_MANAGER_CONTROL_CLIENT_SOURCES})
+
+SET_TARGET_PROPERTIES(
+    ${TARGET_KEY_MANAGER_CONTROL_CLIENT}
+    PROPERTIES
+        COMPILE_FLAGS "-D_GNU_SOURCE -fPIC -fvisibility=default" 
+        SOVERSION ${KEY_MANAGER_CONTROL_CLIENT_VERSION_MAJOR}
+        VERSION ${KEY_MANAGER_CONTROL_CLIENT_VERSION}
+    )
+
+TARGET_LINK_LIBRARIES(${TARGET_KEY_MANAGER_CONTROL_CLIENT}
+    ${KEY_MANAGER_DEP_LIBRARIES}
+    ${TARGET_KEY_MANAGER_COMMON}
+    )
+
+################################################################################
 INSTALL(TARGETS ${TARGET_KEY_MANAGER_CLIENT} DESTINATION ${LIB_INSTALL_DIR})
+INSTALL(TARGETS ${TARGET_KEY_MANAGER_CONTROL_CLIENT} DESTINATION ${LIB_INSTALL_DIR})
 
 INSTALL(TARGETS ${TARGET_KEY_MANAGER} DESTINATION bin)
 
 
 INSTALL(FILES
     ${KEY_MANAGER_SRC_PATH}/include/ckm/key-manager.h
+    ${KEY_MANAGER_SRC_PATH}/include/ckm/key-manager-control.h
     ${KEY_MANAGER_SRC_PATH}/include/ckm/ckm-error.h
     ${KEY_MANAGER_SRC_PATH}/include/ckm/ckm-type.h
     DESTINATION /usr/include/ckm/ckm
diff --git a/src/include/ckm/key-manager-control.h b/src/include/ckm/key-manager-control.h
new file mode 100644 (file)
index 0000000..5491add
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ *  Copyright (c) 2000 - 2013 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        key-manager.h
+ * @author      Bartlomiej Grzelewski (b.grzelewski@samsung.com)
+ * @version     1.0
+ * @brief       Main header file for client library.
+ */
+#pragma once
+
+#include <string>
+#include <vector>
+#include <memory>
+
+#include <ckm/ckm-error.h>
+#include <ckm/ckm-type.h>
+
+// Central Key Manager namespace
+namespace CKM {
+
+// used by login manager to unlock user data with global password
+class Control
+{
+public:
+    Control();
+    // decrypt user key with password
+    int unlockUserKey(uid_t user, const std::string &password) const;
+
+    // remove user key from memory
+    int lockUserKey(uid_t user) const;
+
+    // remove user data from Store and erase key used for encryption
+    int removeUserData(uid_t user) const;
+
+    // change password for user
+    int changeUserPassword(uid_t user, const std::string &oldPassword, const std::string &newPassword) const;
+
+    // This is work around for security-server api - resetPassword that may be called without passing oldPassword.
+    // This api should not be supported on tizen 3.0
+    // User must be already logged in and his DKEK is already loaded into memory in plain text form.
+    // The service will use DKEK in plain text and encrypt it in encrypted form (using new password).
+    int resetUserPassword(uid_t user, const std::string &newPassword) const;
+
+    virtual ~Control();
+private:
+    class ControlImpl;
+    std::shared_ptr<ControlImpl> m_impl;
+};
+
+} // namespace CKM
+
index 7cc3bbc..5fb4947 100644 (file)
 // Central Key Manager namespace
 namespace CKM {
 
-// used by login manager to unlock user data with global password
-class Control
-{
-public:
-    Control();
-    // decrypt user key with password
-    int unlockUserKey(uid_t user, const std::string &password) const;
-
-    // remove user key from memory
-    int lockUserKey(uid_t user) const;
-
-    // remove user data from Store and erase key used for encryption
-    int removeUserData(uid_t user) const;
-
-    // change password for user
-    int changeUserPassword(uid_t user, const std::string &oldPassword, const std::string &newPassword) const;
-
-    // This is work around for security-server api - resetPassword that may be called without passing oldPassword.
-    // This api should not be supported on tizen 3.0
-    // User must be already logged in and his DKEK is already loaded into memory in plain text form.
-    // The service will use DKEK in plain text and encrypt it in encrypted form (using new password).
-    int resetUserPassword(uid_t user, const std::string &newPassword) const;
-
-    virtual ~Control();
-private:
-    class ControlImpl;
-    std::shared_ptr<ControlImpl> m_impl;
-};
-
 class Key {
 public:
     Key();
index 03eecd4..393abac 100644 (file)
@@ -24,7 +24,7 @@
 #include <message-buffer.h>
 #include <protocols.h>
 
-#include <ckm/key-manager.h>
+#include <ckm/key-manager-control.h>
 
 namespace CKM {
 
old mode 100755 (executable)
new mode 100644 (file)
index aa76b3b..402365d 100644 (file)
@@ -22,6 +22,7 @@
 #include <dpl/serialization.h>
 #include <dpl/log/log.h>
 #include <ckm/key-manager.h>
+#include <ckm/key-manager-control.h>
 #include <ckm/ckm-error.h>
 #include <ckm/ckm-type.h>
 #include <key-provider.h>