From 0383805b72953ebaa00806a3a39f722e29beb5af Mon Sep 17 00:00:00 2001
From: gcontini <1121667+gcontini@users.noreply.github.com>
Date: 周日, 03 11月 2019 15:35:29 +0800
Subject: [PATCH] issue #42 (first part)

---
 .gitignore                           |    7 
 .gitmodules                          |    4 
 src/templates/build_properties.h.in  |    0 
 cmake/Findolm.cmake                  |   82 ++++++++++
 cmake/utilities.cmake                |    0 
 CMakeLists.txt.bak                   |  137 +++++++++++++++++
 CMakeLists.txt                       |  166 +++++++-------------
 README.md                            |   16 +
 cmake/target_arch.cmake              |    0 
 src/library/base/CMakeLists.txt      |    2 
 build/.gitkeep                       |    0 
 /dev/null                            |   37 ----
 test/functional/CMakeLists.txt       |    2 
 extern/license-generator             |    1 
 cmake/toolchain-ubuntu-mingw64.cmake |    0 
 src/CMakeLists.txt                   |    2 
 product/.gitkeep                     |    1 
 test/CMakeLists.txt                  |    1 
 18 files changed, 299 insertions(+), 159 deletions(-)

diff --git a/.gitignore b/.gitignore
index 7165b6c..469799c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,7 +18,8 @@
 /Testing
 
 # Cmake generated files
-build
+build/*
+!build/.gitkeep 
 
 #eclipse files
 .cproject
@@ -26,3 +27,7 @@
 .project
 *.out
 /Default/
+
+product/*
+!product/.gitkeep
+
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..f4a9967
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,4 @@
+[submodule "extern/license-generator"]
+	path = extern/license-generator
+	url = https://github.com/open-license-manager/olm-license-generator.git
+	branch = feature/issue_licenses_42
\ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 411c2c2..509c4a8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,120 +1,46 @@
-
 cmake_minimum_required(VERSION 2.8.11 FATAL_ERROR)
 
 #version variables, major and minor must be 1 character only
 SET(LICENSECC_MAJOR_VERSION 1)
 SET(LICENSECC_MINOR_VERSION 1)
-SET(LICENSECC_PATCH_VERSION 0 CACHE STRING "License++ patch version string")
+SET(LICENSECC_PATCH_VERSION 0 CACHE STRING "Licensecc patch version string")
 SET(LICENSECC_INT_VERSION "${LICENSECC_MAJOR_VERSION}${LICENSECC_MINOR_VERSION}${LICENSECC_PATCH_VERSION}")
 SET(LICENSECC_VERSION "${LICENSECC_MAJOR_VERSION}.${LICENSECC_MINOR_VERSION}.${LICENSECC_PATCH_VERSION}")
 SET(LICENSECC_SHORT_LICENSE "BSD Software License")
 
-SET(CMAKE_DISABLE_SOURCE_CHANGES ON)
+SET(CMAKE_DISABLE_SOURCE_CHANGES OFF) #keys are generated in the source tree by default
 SET(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
-SET(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "CMake verbose")
 
-project (license++ C CXX )
+IF(NOT LCC_PRODUCT_NAME)
+	message(WARNING "You should define a variable LCC_PRODUCT_NAME containing the name of the software you want to add a license to."
+		"A mock product named DEFAULT has been added for you.")
+	set(LCC_PRODUCT_NAME "DEFAULT") 
+ENDIF(NOT LCC_PRODUCT_NAME)
+
+#base folder where product names are stored (/projects)
+IF(NOT LCC_PRODUCTS_BASE_DIR)
+	set(LCC_PRODUCTS_BASE_DIR "${CMAKE_SOURCE_DIR}/product") 
+ENDIF(NOT LCC_PRODUCTS_BASE_DIR)
+
+project (licensecc C CXX )
 SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
-SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/modules/")
+SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
 
-include(utilities)
-if(CMAKE_BUILD_TYPE)
-	string(TOLOWER ${CMAKE_BUILD_TYPE} _CMAKE_BUILD_TYPE)
-	EVAL_CONDITION(RELEASE_BUILD ${_CMAKE_BUILD_TYPE} STREQUAL "release")
-else(CMAKE_BUILD_TYPE)
-	SET(RELEASE_BUILD 0)
-endif(CMAKE_BUILD_TYPE)
+#find olm executable or build it.
+find_package(olm REQUIRED) 
 
-if(MSVC)
-	SET(PLATFORM_LIBS "")
-	include(target_arch)
-	target_architecture( TARGET_ARCHITECTURE )
-	message(STATUS "architecture detected: ${TARGET_ARCHITECTURE}")
-	
-	#Boost > 3.15 handle the /MD flag more nicely than this
-	if(${STATIC_RUNTIME})
-		string(REPLACE "/MD" "/MT" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
-		string(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
-		string(REPLACE "/MDd" "/MTd" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
-		string(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
-		SET(Boost_USE_STATIC_RUNTIME ON)
-	endif(${STATIC_RUNTIME})
+#load the current project from files or find it from environment variables or create a default one
+set(LCC_PROJECT_PUBLIC_KEY "${LCC_PRODUCTS_BASE_DIR}/${LCC_PRODUCT_NAME}/include/${PROJECT_NAME}/${LCC_PRODUCT_NAME}/public_key.h" )
+set(LCC_PROJECT_PRIVATE_KEY "${LCC_PRODUCTS_BASE_DIR}/${LCC_PRODUCT_NAME}/private_key.rsa" )
 
-	#SET(CMAKE_FIND_LIBRARY_SUFFIXES .lib ) #${CMAKE_FIND_LIBRARY_SUFFIXES}
-	add_definitions("/D _CRT_SECURE_NO_WARNINGS")
-else(MSVC)
-	#GCC or Mingw
-    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pipe -fmessage-length=0 -std=c++11 -Wuninitialized -fPIC") #-Wall
-    SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pipe -fmessage-length=0 -Wall -Wuninitialized -fPIC") 
-    SET(CMAKE_EXE_LINKER_FLAGS  "-pthread -static-libstdc++")
-    SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "-Wl,--strip-all -static-libstdc++") #-static 
-    #you need to "force" the change in cmake_install_prefix after the project keyword
-	IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
-		SET(CMAKE_INSTALL_PREFIX "/usr/local" CACHE PATH "Install path prefix" FORCE)
-	ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
-    if(MINGW)
-        list(APPEND EXTERNAL_LIBS "-lcrypt32 -lws2_32 -liphlpapi")
-        SET(CMAKE_EXE_LINKER_FLAGS "-static")
-    endif(MINGW)
-	
-	if(USE_DBUS_IDENTIFIER)
-	    FIND_PACKAGE(Dbus REQUIRED)
-	    add_definitions(-DUSE_DBUS)
-	    include_directories(${DBUS_INCLUDE_DIR})
-	    include_directories(${DBUS_ARCH_INCLUDE_DIR})
-	    list(APPEND EXTERNAL_LIBS ${DBUS_LIBRARIES})
-	endif(USE_DBUS_IDENTIFIER)    
-endif(MSVC)
-
-if(UNIX) #this is true for all the linux systems but not for cross compiling
-	#find a static version of openssl crypto library
-	SET ( OPENSSL_USE_STATIC_LIBS ON )
-	find_package(OpenSSL REQUIRED COMPONENTS Crypto)
-	include_directories(${OPENSSL_INCLUDE_DIR})
-    list(APPEND EXTERNAL_LIBS ${OPENSSL_CRYPTO_LIBRARY})
-	MESSAGE(STATUS "Found openssl version ${OPENSSL_VERSION} ")
-	#Zlib required when openssl version < 1.0.1f
-	SET ( ZLIB_USE_STATIC_LIBS ON )
-	find_package(ZLIB REQUIRED)
-	list(APPEND EXTERNAL_LIBS ${ZLIB_LIBRARIES})
-	MESSAGE(STATUS "Found zlib version ${ZLIB_VERSION} ")
-	if(NOT MINGW)
- 		list(APPEND EXTERNAL_LIBS "-ldl") 
-	endif(NOT MINGW)
-	find_program( MEMORYCHECK_COMMAND valgrind )
-	set( MEMORYCHECK_COMMAND_OPTIONS "--trace-children=yes --leak-check=full" )
-endif(UNIX)
-
-SET_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:Debug>:_DEBUG>)
-
-if(CMAKE_SIZEOF_VOID_P EQUAL 8)
-  SET(HAVE_64BIT_SIZE_T 1)
-else(CMAKE_SIZEOF_VOID_P EQUAL 8)
-  SET(HAVE_64BIT_SIZE_T 0)
-endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
-
-#bug in cmake win32 - can't find boost compiled with mingw 
-if(WIN32 AND "x${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "x")
-    message(WARNING "WIN32 compiler does not specify CMAKE_CXX_COMPILER_ARCHITECTURE_ID -- filling in manually")
-    if(CMAKE_SIZEOF_VOID_P EQUAL 8)
-        set(CMAKE_CXX_COMPILER_ARCHITECTURE_ID "x64")
-    else()
-        set(CMAKE_CXX_COMPILER_ARCHITECTURE_ID "x86")
-    endif()
-    message(STATUS "Compiler architecture: ${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}")
-endif()
-
-SET( Boost_USE_STATIC_LIBS ON )
-find_package(Boost REQUIRED COMPONENTS date_time unit_test_framework program_options system filesystem)
-#set below in case of dynamic linking in debug.
-#set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:Debug>:BOOST_TEST_DYN_LINK>)
-add_definitions(-DBOOST_ALL_NO_LIB) #Disable Boost Microsoft magic, all dependencies are handled by cmake
-add_definitions(-DBOOST_LIB_DIAGNOSTIC) #Check it is really disabled
-
-configure_file (
-	"src/build_properties.h.in" 
-	"${CMAKE_BINARY_DIR}/build_properties.h"
+add_custom_command(
+  OUTPUT "${LCC_PROJECT_PUBLIC_KEY}" "${LCC_PROJECT_PRIVATE_KEY}"
+  COMMAND license_generator::olm project initialize -s "${PROJECT_SOURCE_DIR}" -n "${LCC_PRODUCT_NAME}" -p "${LCC_PRODUCTS_BASE_DIR}"
+  COMMENT "generating ${LCC_PROJECT_PUBLIC_KEY}"
+  USES_TERMINAL
 )
+
+add_custom_target(product_initialize DEPENDS "${LCC_PROJECT_PUBLIC_KEY}" "${LCC_PROJECT_PRIVATE_KEY}")
 
 message( STATUS "C compiler        : " ${CMAKE_C_COMPILER})
 message( STATUS "C compiler flags  : " ${CMAKE_C_FLAGS})
@@ -126,18 +52,38 @@
   message( STATUS "Build type        : " ${CMAKE_BUILD_TYPE})
 endif(CMAKE_BUILD_TYPE)
 message( STATUS "Install prefix    : " ${CMAKE_INSTALL_PREFIX})
+message( STATUS "olm executable    : " ${OLM_VERSION})
 
-#include build directory to find build_properties.h
-include_directories(${CMAKE_BINARY_DIR})
+#boost is required only for tests
+#bug in cmake win32 - can't find boost compiled with mingw 
+if(WIN32 AND "x${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "x")
+    message(WARNING "WIN32 compiler does not specify CMAKE_CXX_COMPILER_ARCHITECTURE_ID -- filling in manually")
+    if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+        set(CMAKE_CXX_COMPILER_ARCHITECTURE_ID "x64")
+    else()
+        set(CMAKE_CXX_COMPILER_ARCHITECTURE_ID "x86")
+    endif()
+	    message(STATUS "Compiler architecture: ${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}")
+endif()
 
 add_subdirectory(src)
 
-INCLUDE(CTest)
-ENABLE_TESTING()
-IF(BUILD_TESTING)
-  SET(BUILDNAME "${BUILDNAME}" CACHE STRING "Name of build on the dashboard")
-  MARK_AS_ADVANCED(BUILDNAME)
-ENDIF(BUILD_TESTING)
-add_subdirectory(test)
+SET( Boost_USE_STATIC_LIBS ON )
+find_package(Boost REQUIRED COMPONENTS date_time unit_test_framework program_options system filesystem)
+#set below in case of dynamic linking in debug.
+#set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:Debug>:BOOST_TEST_DYN_LINK>)
 
+#if boost is found enable tests
+IF(Boost_FOUND)
+	INCLUDE(CTest)
+	IF(BUILD_TESTING)
+		SET(BUILDNAME "${BUILDNAME}" CACHE STRING "Name of build on the dashboard")
+		MARK_AS_ADVANCED(BUILDNAME)
+		add_definitions(-DBOOST_ALL_NO_LIB) #Disable Boost Microsoft magic, all dependencies are handled by cmake
+		add_definitions(-DBOOST_LIB_DIAGNOSTIC) #Check it is really disabled
+#		add_subdirectory(test)
+	ENDIF(BUILD_TESTING)
+ELSE(Boost_FOUND)
+	message(WARNING "Boost not found, disabling tests")
+ENDIF(Boost_FOUND)
 
diff --git a/CMakeLists.txt.bak b/CMakeLists.txt.bak
new file mode 100644
index 0000000..edd91f9
--- /dev/null
+++ b/CMakeLists.txt.bak
@@ -0,0 +1,137 @@
+cmake_minimum_required(VERSION 2.8.11 FATAL_ERROR)
+
+#version variables, major and minor must be 1 character only
+SET(LICENSECC_MAJOR_VERSION 1)
+SET(LICENSECC_MINOR_VERSION 1)
+SET(LICENSECC_PATCH_VERSION 0 CACHE STRING "Licensecc patch version string")
+SET(LICENSECC_INT_VERSION "${LICENSECC_MAJOR_VERSION}${LICENSECC_MINOR_VERSION}${LICENSECC_PATCH_VERSION}")
+SET(LICENSECC_VERSION "${LICENSECC_MAJOR_VERSION}.${LICENSECC_MINOR_VERSION}.${LICENSECC_PATCH_VERSION}")
+SET(LICENSECC_SHORT_LICENSE "BSD Software License")
+
+SET(CMAKE_DISABLE_SOURCE_CHANGES ON)
+SET(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
+
+project (licensecc C CXX )
+SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
+SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
+
+include(utilities) #import module utilities.cmake
+if(CMAKE_BUILD_TYPE)
+	string(TOLOWER ${CMAKE_BUILD_TYPE} _CMAKE_BUILD_TYPE)
+	EVAL_CONDITION(RELEASE_BUILD ${_CMAKE_BUILD_TYPE} STREQUAL "release")
+else(CMAKE_BUILD_TYPE)
+	SET(RELEASE_BUILD 0)
+endif(CMAKE_BUILD_TYPE)
+
+if(MSVC)
+	SET(PLATFORM_LIBS "")
+	include(target_arch)
+	target_architecture( TARGET_ARCHITECTURE )
+	message(STATUS "architecture detected: ${TARGET_ARCHITECTURE}")
+	
+	#Boost > 3.15 handle the /MD flag more nicely than this
+	if(${STATIC_RUNTIME})
+		string(REPLACE "/MD" "/MT" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
+		string(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
+		string(REPLACE "/MDd" "/MTd" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
+		string(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
+		SET(Boost_USE_STATIC_RUNTIME ON)
+	endif(${STATIC_RUNTIME})
+
+	#SET(CMAKE_FIND_LIBRARY_SUFFIXES .lib ) #${CMAKE_FIND_LIBRARY_SUFFIXES}
+	add_definitions("/D _CRT_SECURE_NO_WARNINGS")
+else(MSVC)
+	#GCC or Mingw
+    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pipe -fmessage-length=0 -std=c++11 -Wuninitialized -fPIC") #-Wall
+    SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pipe -fmessage-length=0 -Wall -Wuninitialized -fPIC") 
+    SET(CMAKE_EXE_LINKER_FLAGS  "-pthread -static-libstdc++")
+    SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "-Wl,--strip-all -static-libstdc++") #-static 
+    if(MINGW)
+        list(APPEND EXTERNAL_LIBS "-lcrypt32 -lws2_32 -liphlpapi")
+        SET(CMAKE_EXE_LINKER_FLAGS "-static")
+    endif(MINGW)
+	
+	if(USE_DBUS_IDENTIFIER)
+	    FIND_PACKAGE(Dbus REQUIRED)
+	    add_definitions(-DUSE_DBUS)
+	    include_directories(${DBUS_INCLUDE_DIR})
+	    include_directories(${DBUS_ARCH_INCLUDE_DIR})
+	    list(APPEND EXTERNAL_LIBS ${DBUS_LIBRARIES})
+	endif(USE_DBUS_IDENTIFIER)    
+endif(MSVC)
+
+if(UNIX) #this is true for all the linux systems but not for cross compiling
+	#find a static version of openssl crypto library
+	SET ( OPENSSL_USE_STATIC_LIBS ON )
+	find_package(OpenSSL REQUIRED COMPONENTS Crypto)
+	include_directories(${OPENSSL_INCLUDE_DIR})
+    list(APPEND EXTERNAL_LIBS ${OPENSSL_CRYPTO_LIBRARY})
+	MESSAGE(STATUS "Found openssl version ${OPENSSL_VERSION} ")
+	#Zlib required when openssl version < 1.0.1f
+	SET ( ZLIB_USE_STATIC_LIBS ON )
+	find_package(ZLIB REQUIRED)
+	list(APPEND EXTERNAL_LIBS ${ZLIB_LIBRARIES})
+	MESSAGE(STATUS "Found zlib version ${ZLIB_VERSION} ")
+	if(NOT MINGW)
+ 		list(APPEND EXTERNAL_LIBS "-ldl") 
+	endif(NOT MINGW)
+	find_program( MEMORYCHECK_COMMAND valgrind )
+	set( MEMORYCHECK_COMMAND_OPTIONS "--trace-children=yes --leak-check=full" )
+endif(UNIX)
+
+SET_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:Debug>:_DEBUG>)
+
+if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+  SET(HAVE_64BIT_SIZE_T 1)
+else(CMAKE_SIZEOF_VOID_P EQUAL 8)
+  SET(HAVE_64BIT_SIZE_T 0)
+endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
+
+#bug in cmake win32 - can't find boost compiled with mingw 
+if(WIN32 AND "x${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "x")
+    message(WARNING "WIN32 compiler does not specify CMAKE_CXX_COMPILER_ARCHITECTURE_ID -- filling in manually")
+    if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+        set(CMAKE_CXX_COMPILER_ARCHITECTURE_ID "x64")
+    else()
+        set(CMAKE_CXX_COMPILER_ARCHITECTURE_ID "x86")
+    endif()
+    message(STATUS "Compiler architecture: ${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}")
+endif()
+
+SET( Boost_USE_STATIC_LIBS ON )
+find_package(Boost REQUIRED COMPONENTS date_time unit_test_framework program_options system filesystem)
+#set below in case of dynamic linking in debug.
+#set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:Debug>:BOOST_TEST_DYN_LINK>)
+add_definitions(-DBOOST_ALL_NO_LIB) #Disable Boost Microsoft magic, all dependencies are handled by cmake
+add_definitions(-DBOOST_LIB_DIAGNOSTIC) #Check it is really disabled
+
+configure_file (
+	"src/build_properties.h.in" 
+	"${CMAKE_BINARY_DIR}/build_properties.h"
+)
+
+message( STATUS "C compiler        : " ${CMAKE_C_COMPILER})
+message( STATUS "C compiler flags  : " ${CMAKE_C_FLAGS})
+message( STATUS "CXX compiler      : " ${CMAKE_CXX_COMPILER})
+message( STATUS "CXX compiler flags: " ${CMAKE_CXX_FLAGS})
+message( STATUS "CXX compiler flags debug : " ${CMAKE_CXX_FLAGS_DEBUG})
+message( STATUS "CXX compiler flags release: " ${CMAKE_CXX_FLAGS_RELEASE})
+if(CMAKE_BUILD_TYPE)
+  message( STATUS "Build type        : " ${CMAKE_BUILD_TYPE})
+endif(CMAKE_BUILD_TYPE)
+message( STATUS "Install prefix    : " ${CMAKE_INSTALL_PREFIX})
+
+#include build directory to find build_properties.h
+include_directories(${CMAKE_BINARY_DIR})
+
+add_subdirectory(src)
+
+INCLUDE(CTest)
+ENABLE_TESTING()
+IF(BUILD_TESTING)
+  SET(BUILDNAME "${BUILDNAME}" CACHE STRING "Name of build on the dashboard")
+  MARK_AS_ADVANCED(BUILDNAME)
+ENDIF(BUILD_TESTING)
+#add_subdirectory(test)
+
+
diff --git a/README.md b/README.md
index 72838b4..eead71f 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,12 @@
 # Open License Manager
-[![Build Status](https://travis-ci.org/open-license-manager/open-license-manager.svg?branch=develop)](https://travis-ci.org/open-license-manager/open-license-manager)
+
+[![Language](https://img.shields.io/badge/language-C++-blue.svg)](https://isocpp.org/)
+[![Standard](https://img.shields.io/badge/c%2B%2B-11-blue.svg)](https://en.wikipedia.org/wiki/C%2B%2B#Standardization)
 [![experimental](http://badges.github.io/stability-badges/dist/experimental.svg)](http://github.com/badges/stability-badges)[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
+[![Build Status](https://travis-ci.org/open-license-manager/open-license-manager.svg?branch=develop)](https://travis-ci.org/open-license-manager/open-license-manager)
+[![Coverage Status](https://codecov.io/gh/jinja2cpp/Jinja2Cpp/branch/master/graph/badge.svg)](https://codecov.io/gh/jinja2cpp/Jinja2Cpp)
+[![Codacy Badge](https://api.codacy.com/project/badge/Grade/62d6e1bb22d648bd85b6f3bc344a545a)](https://www.codacy.com/manual/gcontini/open-license-manager?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=open-license-manager/open-license-manager&amp;utm_campaign=Badge_Grade)
+[![Github Issues](![GitHub issues](https://img.shields.io/github/issues/open-license-manager/open-license-manager))](http://github.com/open-license-manager/open-license-manager/issues)
 
 A copy protection, licensing software written in C++ for Windows and Linux (with a simple C api for use in C projects).
 
@@ -16,17 +22,13 @@
 
 ## Project Structure
 The software is made by 2 main sub-components:
- * a C library with no (or minimal) external dependencies (the part you have to integrate in your software).
- * a license generator written in C++ (allows you to generate a license).
+ * a C++ library with a nice C api, `licensecc` with minimal (or no) external dependencies (the part you have to integrate in your software).
+ * a license generator open-license-manager `olm` that allows you to generate a license.
  
 these modules are planned....
  * a license [backoffice](../../issues/7) in php (in order to handle multiple licenses).
  * a license debugger to be sent to the final customer when there are licensing problems. 
  * a [log descriptor](../../issues/8) in order to decrypt logs generated by the license system.
-
-You can notice 2 more sub-projects:
- * bootstrap: allows to generate private keys and modify the library on the fly after the downloading.
- * testing  : runs the tests (and publish the results on cdash)
 
 # How to build
 
diff --git a/build/.gitkeep b/build/.gitkeep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/build/.gitkeep
diff --git a/cmake/Findolm.cmake b/cmake/Findolm.cmake
new file mode 100644
index 0000000..87b35e7
--- /dev/null
+++ b/cmake/Findolm.cmake
@@ -0,0 +1,82 @@
+# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+#[=======================================================================[.rst:
+Findolm
+-------
+
+Find or build the olm executable.
+
+Imported Targets
+^^^^^^^^^^^^^^^^
+
+This module provides the following imported targets, if found:
+
+``license_generator::olm``
+  The olm executable
+
+If olm is not found this module will try to download it as a submodule
+Git must be installed.
+
+Input variables
+^^^^^^^^^^^^^^^^
+
+``OLM_LOCATION`` Hint for locating the olm executable
+
+Result Variables
+^^^^^^^^^^^^^^^^
+
+This will define the following variables:
+
+``OLM_FOUND``
+  True if the system has the Foo library.
+``olm_VERSION``
+
+Cache Variables
+^^^^^^^^^^^^^^^
+
+The following cache variables may also be set:
+
+``OLM_EXECUTABLE``
+  Path to the olm executable.
+
+#]=======================================================================]
+
+set(olm_names olm olm.exe)
+set (failure_messge "Error finding olm executable.")
+find_package(PkgConfig)
+
+if(OLM_LOCATION)
+	# First search the PATH and specific locations.
+	find_program(OLM_EXECUTABLE
+	  NAMES ${olm_names} HINTS ${OLM_LOCATION} DOC "olm command line client")
+	FIND_PACKAGE_HANDLE_STANDARD_ARGS(olm FOUND_VAR OLM_FOUND
+                                       REQUIRED_VARS OLM_EXECUTABLE 
+                                       FAIL_MESSAGE "Error finding olm executable. variable OLM_LOCATION non set correctly.")
+    add_executable(license_generator::olm IMPORTED GLOBAL)                                            
+	set_property(TARGET license_generator::olm PROPERTY IMPORTED_LOCATION ${OLM_EXECUTABLE})  
+ELSE(OLM_LOCATION)
+	find_package(olm REQUIRED NO_CMAKE_PATH) #try to find it without looping on this module
+	IF(NOT olm_FOUND) 	
+		find_package(Git QUIET)
+		if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
+		# Update submodules as needed
+		    option(GIT_SUBMODULE "Check submodules during build" ON)
+		    if(GIT_SUBMODULE)
+		        message(STATUS "Submodule update")
+#		        execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
+#		                        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+#		                        RESULT_VARIABLE GIT_SUBMOD_RESULT)
+		        if(NOT GIT_SUBMOD_RESULT EQUAL "0")
+		            set(failure_messge  "git submodule update --init failed with ${GIT_SUBMOD_RESULT}, please checkout submodules")
+		        endif()
+		    endif()
+		endif()
+		if(NOT EXISTS "${PROJECT_SOURCE_DIR}/extern/license-generator/CMakeLists.txt")
+		    set(failure_messge  "All the options to find olm executable failed. And i can't compile one from source GIT_SUBMODULE was turned off or failed. Please update submodules and try again.")
+		endif()
+		add_subdirectory("${PROJECT_SOURCE_DIR}/extern/license-generator")
+	ENDIF(NOT olm_FOUND)
+ENDIF(OLM_LOCATION)
+
+
diff --git a/modules/target_arch.cmake b/cmake/target_arch.cmake
similarity index 100%
rename from modules/target_arch.cmake
rename to cmake/target_arch.cmake
diff --git a/modules/toolchain-ubuntu-mingw64.cmake b/cmake/toolchain-ubuntu-mingw64.cmake
similarity index 100%
rename from modules/toolchain-ubuntu-mingw64.cmake
rename to cmake/toolchain-ubuntu-mingw64.cmake
diff --git a/modules/utilities.cmake b/cmake/utilities.cmake
similarity index 100%
rename from modules/utilities.cmake
rename to cmake/utilities.cmake
diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt
deleted file mode 100644
index 87016f4..0000000
--- a/example/CMakeLists.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-cmake_minimum_required(VERSION 2.8.11)
-
-link_directories (   "${CMAKE_CURRENT_SOURCE_DIR}/../install/lib" )
-include_directories( "${CMAKE_CURRENT_SOURCE_DIR}/../install/include" )
-
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
-
-if(MSVC)
-SET(CMAKE_FIND_LIBRARY_SUFFIXES .lib )
-else(MSVC)
-set(CMAKE_FIND_LIBRARY_SUFFIXES .a .so)
-set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s -Wl,--exclude-libs,liblicensecc_static.a")
-find_package(OpenSSL REQUIRED)
-endif(MSVC)
-
-include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
-
-add_executable(example example.cpp)
-
-target_link_libraries(example licensecc_static os base tools_base)
-
-if(NOT MSVC)
-target_link_libraries(example crypto pthread dl z)
-endif(NOT MSVC)
-
-if(MINGW)
-target_link_libraries(example iphlpapi)
-endif(MINGW)
diff --git a/example/example.cpp b/example/example.cpp
deleted file mode 100644
index 2379d6a..0000000
--- a/example/example.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-#include <iostream>
-#include <map>
-#include "api/license++.h"
-#include "pc-identifiers.h"
-
-using namespace std;
-
-int main(int argc, char *argv[]) {
-	map<EVENT_TYPE, string> stringByEventType;
-	stringByEventType[LICENSE_OK] = "OK ";
-	stringByEventType[LICENSE_FILE_NOT_FOUND] = "license file not found ";
-	stringByEventType[LICENSE_SERVER_NOT_FOUND] = "license server can't be contacted ";
-	stringByEventType[ENVIRONMENT_VARIABLE_NOT_DEFINED] = "environment variable not defined ";
-	stringByEventType[FILE_FORMAT_NOT_RECOGNIZED] = "license file has invalid format (not .ini file) ";
-	stringByEventType[LICENSE_MALFORMED] = "some mandatory field are missing, or data can't be fully read. ";
-	stringByEventType[PRODUCT_NOT_LICENSED] = "this product was not licensed ";
-	stringByEventType[PRODUCT_EXPIRED] = "license expired ";
-	stringByEventType[LICENSE_CORRUPTED] = "license signature didn't match with current license ";
-	stringByEventType[IDENTIFIERS_MISMATCH] = "Calculated identifier and the one provided in license didn't match";
-
-	LicenseInfo licenseInfo;
-	EVENT_TYPE result = acquire_license("example", nullptr, &licenseInfo);
-
-	if (result == LICENSE_OK) {
-		//for this example we want to link the license to the execution hardware.
-		if (licenseInfo.linked_to_pc) {
-			cout
-					<< "No client signature in license file, generate license with -s <id>";
-			result = IDENTIFIERS_MISMATCH;
-		} else {
-			cout << "license OK" << endl;
-		}
-	}
-	if (result != LICENSE_OK) {
-		cout << "license ERROR :" << endl;
-		cout << "    " << stringByEventType[result].c_str() << endl;
-		if (result == IDENTIFIERS_MISMATCH) {
-			PcSignature signature;
-			FUNCTION_RETURN generate_ok = generate_user_pc_signature(signature,
-					DEFAULT);
-			cout << "the pc signature is :" << endl;
-			cout << "    " << signature << endl;
-		}
-	}
-
-	return result;
-}
diff --git a/extern/license-generator b/extern/license-generator
new file mode 160000
index 0000000..5c4ebec
--- /dev/null
+++ b/extern/license-generator
@@ -0,0 +1 @@
+Subproject commit 5c4ebec01b66bc3ad508e711a373ed46cb0a95c3
diff --git a/product/.gitkeep b/product/.gitkeep
new file mode 100644
index 0000000..32f64f4
--- /dev/null
+++ b/product/.gitkeep
@@ -0,0 +1 @@
+t
\ No newline at end of file
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 1fb9b67..fb0f844 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,4 +1,4 @@
 add_subdirectory("library")
-add_subdirectory("tools")
+
 
 	
\ No newline at end of file
diff --git a/src/library/base/CMakeLists.txt b/src/library/base/CMakeLists.txt
index 0a61fdf..0ca6e50 100644
--- a/src/library/base/CMakeLists.txt
+++ b/src/library/base/CMakeLists.txt
@@ -6,6 +6,6 @@
     base64.c
 )
 
-add_dependencies( base public_key )
+add_dependencies( base product_initialize )
 
 install(TARGETS base ARCHIVE DESTINATION lib)
diff --git a/src/build_properties.h.in b/src/templates/build_properties.h.in
similarity index 100%
rename from src/build_properties.h.in
rename to src/templates/build_properties.h.in
diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt
deleted file mode 100644
index 34da47f..0000000
--- a/src/tools/CMakeLists.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-enable_language(CXX)
-add_subdirectory("base_lib")
-add_subdirectory("bootstrap")
-add_subdirectory("pc-identifier")
-add_subdirectory("license-generator")
-
-	
\ No newline at end of file
diff --git a/src/tools/base_lib/CMakeLists.txt b/src/tools/base_lib/CMakeLists.txt
deleted file mode 100644
index 99788b9..0000000
--- a/src/tools/base_lib/CMakeLists.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-
-if(WIN32)
-ADD_LIBRARY(
-    tools_base STATIC
-    CryptoHelper.cpp
-    win/CryptoHelperWindows.cpp
-)
-else(WIN32)
-ADD_LIBRARY(
-    tools_base STATIC
-    CryptoHelper.cpp
-    linux/CryptoHelperLinux.cpp
-)
-ENDIF(WIN32)
-
-target_link_libraries(
-     tools_base
-     ${EXTERNAL_LIBS}
-)
-
-install(TARGETS tools_base ARCHIVE DESTINATION lib)
diff --git a/src/tools/base_lib/CryptoHelper.cpp b/src/tools/base_lib/CryptoHelper.cpp
deleted file mode 100644
index 530596e..0000000
--- a/src/tools/base_lib/CryptoHelper.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <memory>
-#include "CryptoHelper.h"
-#ifdef __linux__
-#include"linux/CryptoHelperLinux.h"
-#elif _WIN32
-#include"win/CryptoHelperWindows.h"
-#endif
-
-using namespace std;
-namespace license {
-
-unique_ptr<CryptoHelper> CryptoHelper::getInstance() {
-#ifdef __linux__ 
-	unique_ptr<CryptoHelper> ptr((CryptoHelper*) new CryptoHelperLinux());
-#elif _WIN32
-	unique_ptr<CryptoHelper> ptr((CryptoHelper*) new CryptoHelperWindows());	
-#endif
-	return ptr;
-}
-}
-
diff --git a/src/tools/base_lib/CryptoHelper.h b/src/tools/base_lib/CryptoHelper.h
deleted file mode 100644
index c1751f8..0000000
--- a/src/tools/base_lib/CryptoHelper.h
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef CRYPTPHELPER_H_
-#define CRYPTPHELPER_H_
-
-#include <memory>
-#include <cstddef>
-#include <string>
-
-namespace license {
-using namespace std;
-/**
- * Helper class definition to generate and export Public/Private keys
- * for Asymmetric encryption.
- *
- * <p>Since this part relies heavily on operating system libraries this class
- * provides a common facade to the cryptographic functions. The two implementing
- * subclasses are chosen in the factory method #getInstance(). This is to avoid
- * to clutter the code with many "ifdef". (extreme performance is not an issue here)</p>
- *<p> *it is shared by bootstrap and license-generator projects.</p>
- */
-
-class CryptoHelper {
-
-protected:
-	inline CryptoHelper(){};
-
-public:
-	virtual void generateKeyPair() = 0;
-	virtual const string exportPrivateKey() const = 0;
-	virtual const string exportPublicKey() const = 0;
-
-	virtual const string signString(const void* privateKey,
-			size_t pklen, const string& license) const = 0;
-	static unique_ptr<CryptoHelper> getInstance();
-	inline virtual ~CryptoHelper(){};
-};
-}
-#endif
diff --git a/src/tools/base_lib/README.TXT b/src/tools/base_lib/README.TXT
deleted file mode 100644
index 838c5e9..0000000
--- a/src/tools/base_lib/README.TXT
+++ /dev/null
@@ -1,3 +0,0 @@
-This is the base library for the tools projects.
-It contains cryptographic functions (that are very different from Linux and 
-Windows operating systems)
\ No newline at end of file
diff --git a/src/tools/base_lib/linux/CryptoHelperLinux.cpp b/src/tools/base_lib/linux/CryptoHelperLinux.cpp
deleted file mode 100644
index d65ac77..0000000
--- a/src/tools/base_lib/linux/CryptoHelperLinux.cpp
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * CryptpHelperLinux.cpp
- *
- *  Created on: Sep 14, 2014
- *      
- */
-
-#include "CryptoHelperLinux.h"
-#include <openssl/evp.h>
-#include <openssl/bio.h>
-#include <openssl/pem.h>
-#include <openssl/err.h>
-#include <openssl/rsa.h>
-#include <stdexcept>
-#include <string>
-#include <cstddef>
-#include <stdexcept>
-
-namespace license {
-using namespace std;
-
-static std::string replaceAll(std::string subject, const std::string& search,
-		const std::string& replace) {
-	size_t pos = 0;
-	while ((pos = subject.find(search, pos)) != std::string::npos) {
-		subject.replace(pos, search.length(), replace);
-		pos += replace.length();
-	}
-	return subject;
-}
-
-CryptoHelperLinux::CryptoHelperLinux() {
-	static int initialized = 0;
-	rsa = NULL;
-	if (initialized == 0) {
-		initialized = 1;
-		ERR_load_ERR_strings();
-		ERR_load_crypto_strings();
-		OpenSSL_add_all_algorithms();
-	}
-
-}
-void CryptoHelperLinux::generateKeyPair() {
-	rsa = RSA_generate_key(kBits, kExp, 0, 0);
-}
-
-const string CryptoHelperLinux::exportPrivateKey() const {
-	if (rsa == NULL) {
-		throw logic_error(
-				string("Export not initialized.Call generateKeyPair first."));
-	}
-	BIO* bio_private = BIO_new(BIO_s_mem());
-	PEM_write_bio_RSAPrivateKey(bio_private, rsa, NULL, NULL, 0, NULL, NULL);
-	int keylen = BIO_pending(bio_private);
-	char* pem_key = (char*) (calloc(keylen + 1, 1)); /* Null-terminate */
-	BIO_read(bio_private, pem_key, keylen);
-	string dest = string("\"")
-			+ replaceAll(string(pem_key), string("\n"), string("\\n\" \\\n\""))
-			+ string("\"");
-	BIO_free_all(bio_private);
-	free(pem_key);
-	return dest;
-}
-
-const string CryptoHelperLinux::exportPublicKey() const {
-	if (rsa == NULL) {
-		throw logic_error(
-				string("Export not initialized.Call generateKeyPair first."));
-	}
-	BIO* bio_public = BIO_new(BIO_s_mem());
-	PEM_write_bio_RSAPublicKey(bio_public, rsa);
-	int keylen = BIO_pending(bio_public);
-	char* pem_key = (char*) (calloc(keylen + 1, 1)); /* Null-terminate */
-	BIO_read(bio_public, pem_key, keylen);
-	std::string dest = string("\"")
-			+ replaceAll(string(pem_key), string("\n"), string("\\n\" \\\n\""))
-			+ string("\"");
-	BIO_free_all(bio_public);
-	free(pem_key);
-	return dest;
-}
-
-string CryptoHelperLinux::signString(const void* privateKey,
-		size_t pklen, const string& license) const {
-	size_t slen;
-	unsigned char* signature;
-	signature = NULL;
-	/* Create the Message Digest Context */
-	EVP_MD_CTX* mdctx = EVP_MD_CTX_create();
-	if (!mdctx) {
-		throw logic_error("Message digest creation context");
-	}
-
-	BIO* bio = BIO_new_mem_buf((void*) (privateKey), pklen);
-	EVP_PKEY *pktmp = PEM_read_bio_PrivateKey(bio, NULL, NULL, NULL);
-	BIO_free(bio);
-	/*Initialise the DigestSign operation - SHA-256 has been selected
-	 * as the message digest function in this example */
-	if (1 != EVP_DigestSignInit(mdctx, NULL, EVP_sha256(), NULL, pktmp)) {
-		EVP_MD_CTX_destroy(mdctx);
-	}
-	/* Call update with the message */
-	if (EVP_DigestSignUpdate(mdctx, (const void* ) license.c_str(),
-			(size_t ) license.length())
-			!= 1) {
-		EVP_MD_CTX_destroy(mdctx);
-		throw logic_error("Message signing exception");
-	}
-	/* Finalise the DigestSign operation */
-	/* First call EVP_DigestSignFinal with a NULL sig parameter to obtain the length of the
-	 * signature. Length is returned in slen */
-	if (EVP_DigestSignFinal(mdctx, NULL, &slen) != 1) {
-		EVP_MD_CTX_destroy(mdctx);
-		throw logic_error("Message signature finalization exception");
-	}
-	/* Allocate memory for the signature based on size in slen */
-	if (!(signature = (unsigned char *) OPENSSL_malloc(
-			sizeof(unsigned char) * slen))) {
-		EVP_MD_CTX_destroy(mdctx);
-		throw logic_error("Message signature memory allocation exception");
-	}
-	/* Obtain the signature */
-	if (1 != EVP_DigestSignFinal(mdctx, signature, &slen)) {
-		OPENSSL_free(signature);
-		EVP_MD_CTX_destroy(mdctx);
-		throw logic_error("Message signature exception");
-	}
-	/*
-	 FILE*  stream = fmemopen(*buffer, encodedSize+1, "w");
-	 */
-	//bio = BIO_new_fp(stdout, BIO_NOCLOSE);
-	/*int encodedSize = 4 * ceil(slen / 3);
-	 char* buffer = (char*) (malloc(encodedSize + 1));
-	 memset(buffer,0,encodedSize+1);*/
-	string signatureStr = Opensslb64Encode(slen, signature);
-	/*
-	 * BIO *bio, *b64;
-	 char message[] = "Hello World \n";
-	 b64 = BIO_new(BIO_f_base64());
-	 bio = BIO_new_fp(stdout, BIO_NOCLOSE);
-	 bio = BIO_push(b64, bio);
-	 BIO_write(bio, message, strlen(message));
-	 BIO_flush(bio);
-	 BIO_free_all(bio);
-	 Read Base64 encoded data from standard input and write the decoded data to standard output:
-
-	 BIO *bio, *b64, *bio_out;
-	 char inbuf[512];
-	 int inlen;
-	 b64 = BIO_new(BIO_f_base64());
-	 bio = BIO_new_fp(stdin, BIO_NOCLOSE);
-	 bio_out = BIO_new_fp(stdout, BIO_NOCLOSE);
-	 bio = BIO_push(b64, bio);
-	 while((inlen = BIO_read(bio, inbuf, 512)) > 0)
-	 BIO_write(bio_out, inbuf, inlen);
-	 BIO_free_all(bio);
-	 */
-	/* Clean up */
-	//free(buffer);
-	if (pktmp)
-		EVP_PKEY_free(pktmp);
-	if (signature)
-		OPENSSL_free(signature);
-
-	if (mdctx)
-		EVP_MD_CTX_destroy(mdctx);
-	return signatureStr;
-}
-
-const string CryptoHelperLinux::Opensslb64Encode(size_t slen,
-		unsigned char* signature) const {
-	/*
-	 FILE*  stream = fmemopen(*buffer, encodedSize+1, "w");
-	 */
-	//bio = BIO_new_fp(stdout, BIO_NOCLOSE);
-	/*int encodedSize = 4 * ceil(slen / 3);
-	 char* buffer = (char*) (malloc(encodedSize + 1));
-	 memset(buffer,0,encodedSize+1);*/
-	BIO* mem_bio = BIO_new(BIO_s_mem());
-	BIO* b64 = BIO_new(BIO_f_base64());
-	BIO* bio1 = BIO_push(b64, mem_bio);
-	BIO_set_flags(bio1, BIO_FLAGS_BASE64_NO_NL);
-	BIO_write(bio1, signature, slen);
-	BIO_flush(bio1);
-	char* charBuf;
-	int sz = BIO_get_mem_data(mem_bio, &charBuf);
-	string signatureStr;
-	signatureStr.assign(charBuf, sz);
-	BIO_free_all(bio1);
-	return signatureStr;
-}
-
-CryptoHelperLinux::~CryptoHelperLinux() {
-	RSA_free(rsa);
-}
-
-} /* namespace license */
diff --git a/src/tools/base_lib/linux/CryptoHelperLinux.h b/src/tools/base_lib/linux/CryptoHelperLinux.h
deleted file mode 100644
index 534b1e3..0000000
--- a/src/tools/base_lib/linux/CryptoHelperLinux.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * CryptpHelperLinux.h
- *
- *  Created on: Sep 14, 2014
- *      
- */
-
-#ifndef CRYPTPHELPERLINUX_H_
-#define CRYPTPHELPERLINUX_H_
-#include <openssl/rsa.h>
-#include <cstddef>
-#include <string>
-
-namespace license {
-using namespace std;
-
-class CryptoHelperLinux {
-private:
-	static const int kBits = 1024;
-	static const int kExp = 65537;
-	RSA * rsa;
-	const string Opensslb64Encode(size_t slen, unsigned char* signature) const;
-public:
-	CryptoHelperLinux();
-
-	virtual void generateKeyPair();
-	virtual const string exportPrivateKey() const;
-	virtual const string exportPublicKey() const;
-
-	virtual string signString(const void* privateKey, size_t pklen,
-			const string& license) const;
-	virtual ~CryptoHelperLinux();
-};
-
-} /* namespace license */
-
-#endif /* CRYPTPHELPERLINUX_H_ */
diff --git a/src/tools/base_lib/win/CryptoHelperWindows.cpp b/src/tools/base_lib/win/CryptoHelperWindows.cpp
deleted file mode 100644
index ff40457..0000000
--- a/src/tools/base_lib/win/CryptoHelperWindows.cpp
+++ /dev/null
@@ -1,394 +0,0 @@
-/*
- * CryptoHelperWindows.cpp
- *
- *  Created on: Sep 14, 2014
- *
- */
-
-#include <sstream> 
-#include <vector>
-#include <string>
-#include "CryptoHelperWindows.h"
-// The RSA public-key key exchange algorithm
-#define ENCRYPT_ALGORITHM         CALG_RSA_SIGN
-// The high order WORD 0x0200 (decimal 512)
-// determines the key length in bits.
-#define KEYLENGTH                 0x02000000
-#pragma comment(lib, "crypt32.lib")
-
-namespace license {
-
-CryptoHelperWindows::CryptoHelperWindows() {
-	m_hCryptProv = NULL;
-	m_hCryptKey = NULL;
-	if (!CryptAcquireContext(&m_hCryptProv, "license_sign", NULL , PROV_RSA_FULL, 0)) {
-		// If the key container cannot be opened, try creating a new
-		// container by specifying a container name and setting the
-		// CRYPT_NEWKEYSET flag.
-		DWORD lastError = GetLastError();
-		printf("Error in CryptAcquireContext (1) 0x%08x \n", lastError);
-		if (NTE_BAD_KEYSET == lastError) {
-			if (!CryptAcquireContext(&m_hCryptProv, "license_sign", NULL , PROV_RSA_FULL, CRYPT_NEWKEYSET)) {
-				printf("Warn in CryptAcquireContext: acquiring new user keyset failed 0x%08x, trying less secure mackine keyset \n", GetLastError());
-				//maybe access to protected storage disabled. Try with machine keys (less secure)
-				if (!CryptAcquireContext(&m_hCryptProv, "license_sign", NULL, PROV_RSA_FULL, CRYPT_MACHINE_KEYSET)) {
-					printf("Error in CryptAcquireContext (2) 0x%08x \n", GetLastError());
-					if (!CryptAcquireContext(&m_hCryptProv, "license_sign", NULL, PROV_RSA_FULL, CRYPT_NEWKEYSET|CRYPT_MACHINE_KEYSET)) {
-						printf("Error in CryptAcquireContext (3): acquiring new keyset(machine) failed 0x%08x \n", GetLastError());
-						throw logic_error("");
-					}
-				}
-			}
-		} else {
-			printf(" Error in CryptAcquireContext (4) 0x%08x \n", lastError);
-			throw logic_error("");
-		}
-	}
-
-}
-
-/**
- This method calls the CryptGenKey function to get a handle to an
-
- exportable key-pair. The key-pair is  generated with the RSA public-key
- key exchange algorithm using Microsoft Enhanced Cryptographic Provider.
- */
-void CryptoHelperWindows::generateKeyPair() {
-	HRESULT hr = S_OK;
-	DWORD dwErrCode;
-	// If the handle to key container is NULL, fail.
-	if (m_hCryptProv == NULL)
-		throw logic_error("Cryptocontext not correctly initialized");
-	// Release a previously acquired handle to key-pair.
-	if (m_hCryptKey)
-		m_hCryptKey = NULL;
-	// Call the CryptGenKey method to get a handle
-	// to a new exportable key-pair.
-	if (!CryptGenKey(m_hCryptProv, ENCRYPT_ALGORITHM,
-	KEYLENGTH | CRYPT_EXPORTABLE, &m_hCryptKey)) {
-		dwErrCode = GetLastError();
-		throw logic_error(
-				string("Error generating keys ")
-						+ to_string(static_cast<long long>(dwErrCode)));
-	}
-	//double check the key is really generated
-	if(m_hCryptKey == NULL) {
-		dwErrCode = GetLastError();
-		throw logic_error(
-				string("Error generating keys (2)")
-						+ to_string(static_cast<long long>(dwErrCode)));
-    }
-}
-
-/* This method calls the CryptExportKey function to get the Public key
- in a string suitable for C source inclusion.
- */
-const string CryptoHelperWindows::exportPublicKey() const {
-	HRESULT hr = S_OK;
-	DWORD dwErrCode;
-	DWORD dwBlobLen;
-	BYTE *pbKeyBlob = nullptr;
-	stringstream ss;
-	// If the handle to key container is NULL, fail.
-	if (m_hCryptKey == NULL)
-		throw logic_error("call GenerateKey first.");
-	// This call here determines the length of the key
-	// blob.
-	if (!CryptExportKey(m_hCryptKey,
-	NULL, PUBLICKEYBLOB, 0, nullptr, &dwBlobLen)) {
-		dwErrCode = GetLastError();
-		throw logic_error(
-				string("Error calculating size of public key ")
-						+ to_string(static_cast<long long>(dwErrCode)));
-	}
-	// Allocate memory for the pbKeyBlob.
-	if ((pbKeyBlob = new BYTE[dwBlobLen]) == nullptr) {
-		throw logic_error(string("Out of memory exporting public key "));
-	}
-	// Do the actual exporting into the key BLOB.
-	if (!CryptExportKey(m_hCryptKey,
-	NULL, PUBLICKEYBLOB, 0, pbKeyBlob, &dwBlobLen)) {
-		delete pbKeyBlob;
-		dwErrCode = GetLastError();
-		throw logic_error(
-				string("Error exporting public key ")
-						+ to_string(static_cast<long long>(dwErrCode)));
-	} else {
-		ss << "\t";
-		for (unsigned int i = 0; i < dwBlobLen; i++) {
-			if (i != 0) {
-				ss << ", ";
-				if (i % 10 == 0) {
-					ss << "\\" << endl << "\t";
-				}
-			}
-			ss << to_string(static_cast<long long>(pbKeyBlob[i]));
-		}
-		delete pbKeyBlob;
-	}
-	return ss.str();
-}
-
-CryptoHelperWindows::~CryptoHelperWindows() {
-	if (m_hCryptProv) {
-		CryptReleaseContext(m_hCryptProv, 0);
-		m_hCryptProv = NULL;
-	}
-	if (m_hCryptKey)
-		m_hCryptKey = NULL;
-}
-
-//--------------------------------------------------------------------
-// This method calls the CryptExportKey function to get the Private key
-// in a byte array. The byte array is allocated on the heap and the size
-// of this is returned to the caller. The caller is responsible for releasing // this memory using a delete call.
-//--------------------------------------------------------------------
-const string CryptoHelperWindows::exportPrivateKey() const {
-	HRESULT hr = S_OK;
-	DWORD dwErrCode;
-	DWORD dwBlobLen;
-	BYTE *pbKeyBlob;
-	stringstream ss;
-	// If the handle to key container is NULL, fail.
-	if (m_hCryptKey == NULL)
-		throw logic_error(string("call GenerateKey first."));
-	// This call here determines the length of the key
-	// blob.
-	if (!CryptExportKey(m_hCryptKey,
-	NULL, PRIVATEKEYBLOB, 0, nullptr, &dwBlobLen)) {
-		dwErrCode = GetLastError();
-		throw logic_error(
-				string("Error calculating size of private key ")
-						+ to_string(static_cast<long long>(dwErrCode)));
-	}
-	// Allocate memory for the pbKeyBlob.
-	if ((pbKeyBlob = new BYTE[dwBlobLen]) == nullptr) {
-		throw logic_error(string("Out of memory exporting private key "));
-	}
-
-	// Do the actual exporting into the key BLOB.
-	if (!CryptExportKey(m_hCryptKey,
-	NULL, PRIVATEKEYBLOB, 0, pbKeyBlob, &dwBlobLen)) {
-		delete pbKeyBlob;
-		dwErrCode = GetLastError();
-		throw logic_error(
-				string("Error exporting private key ")
-						+ to_string(static_cast<long long>(dwErrCode)));
-	} else {
-		ss << "\t";
-		for (unsigned int i = 0; i < dwBlobLen; i++) {
-			if (i != 0) {
-				ss << ", ";
-				if (i % 15 == 0) {
-					ss << "\\" << endl << "\t";
-				}
-			}
-			ss << to_string(static_cast<long long>(pbKeyBlob[i]));
-		}
-		delete pbKeyBlob;
-	}
-	return ss.str();
-}
-
-void CryptoHelperWindows::printHash(HCRYPTHASH *hHash) const {
-	BYTE *pbHash;
-	DWORD dwHashLen;
-	DWORD dwHashLenSize = sizeof(DWORD);
-	char *hashStr;
-	unsigned int i;
-
-	if (CryptGetHashParam(*hHash, HP_HASHSIZE, (BYTE*) &dwHashLen,
-			&dwHashLenSize, 0)) {
-		pbHash = (BYTE*) malloc(dwHashLen);
-		hashStr = (char*) malloc(dwHashLen * 2 + 1);
-		if (CryptGetHashParam(*hHash, HP_HASHVAL, pbHash, &dwHashLen, 0)) {
-			for (i = 0; i < dwHashLen; i++) {
-				sprintf(&hashStr[i * 2], "%02x", pbHash[i]);
-			}
-			printf("hash To be signed: %s \n", hashStr);
-		}
-		free(pbHash);
-		free(hashStr);
-	}
-}
-
-const string CryptoHelperWindows::signString(const void *privateKey,
-		size_t pklen, const string &license) const {
-	BYTE *pbBuffer = (BYTE*) license.c_str();
-	const DWORD dwBufferLen = (DWORD) strlen((char*) pbBuffer);
-	HCRYPTHASH hHash;
-
-	HCRYPTKEY hKey;
-	BYTE *pbSignature;
-	DWORD dwSigLen;
-	DWORD strLen;
-
-	//-------------------------------------------------------------------
-	// Acquire a cryptographic provider context handle.
-
-	if (!CryptImportKey(m_hCryptProv, (const BYTE*) privateKey, (DWORD) pklen,
-			0, 0, &hKey)) {
-		throw logic_error(
-				string("Error in importing the PrivateKey ")
-						+ to_string(static_cast<long long>(GetLastError())));
-	}
-
-	//-------------------------------------------------------------------
-	// Create the hash object.
-
-	if (CryptCreateHash(m_hCryptProv, CALG_SHA1, 0, 0, &hHash)) {
-		printf("Hash object created. \n");
-	} else {
-		CryptDestroyKey(hKey);
-		throw logic_error(string("Error during CryptCreateHash."));
-	}
-	//-------------------------------------------------------------------
-	// Compute the cryptographic hash of the buffer.
-
-	if (CryptHashData(hHash, pbBuffer, dwBufferLen, 0)) {
-#ifdef _DEBUG
-		printf("Length of data to be hashed: %d \n", dwBufferLen);
-		printHash(&hHash);
-#endif 
-	} else {
-		throw logic_error(string("Error during CryptHashData."));
-	}
-	//-------------------------------------------------------------------
-	// Determine the size of the signature and allocate memory.
-
-	dwSigLen = 0;
-	if (CryptSignHash(hHash, AT_SIGNATURE, nullptr, 0, nullptr, &dwSigLen)) {
-		printf("Signature length %d found.\n", dwSigLen);
-	} else {
-		throw logic_error(string("Error during CryptSignHash."));
-	}
-	//-------------------------------------------------------------------
-	// Allocate memory for the signature buffer.
-
-	if (pbSignature = (BYTE*) malloc(dwSigLen)) {
-		printf("Memory allocated for the signature.\n");
-	} else {
-		throw logic_error(string("Out of memory."));
-	}
-	//-------------------------------------------------------------------
-	// Sign the hash object.
-
-	if (CryptSignHash(hHash, AT_SIGNATURE, nullptr, 0, pbSignature,
-			&dwSigLen)) {
-		printf("pbSignature is the signature length. %d\n", dwSigLen);
-	} else {
-		throw logic_error(string("Error during CryptSignHash."));
-	}
-	//-------------------------------------------------------------------
-	// Destroy the hash object.
-
-	CryptDestroyHash(hHash);
-	CryptDestroyKey(hKey);
-
-	CryptBinaryToString(pbSignature, dwSigLen,
-			CRYPT_STRING_BASE64 | CRYPT_STRING_NOCRLF, nullptr, &strLen);
-	vector<char> buffer(strLen);
-	CryptBinaryToString(pbSignature, dwSigLen,
-			CRYPT_STRING_BASE64 | CRYPT_STRING_NOCRLF, &buffer[0], &strLen);
-
-	//-------------------------------------------------------------------
-	// In the second phase, the hash signature is verified.
-	// This would most often be done by a different user in a
-	// separate program. The hash, signature, and the PUBLICKEYBLOB
-	// would be read from a file, an email message,
-	// or some other source.
-
-	// Here, the original pbBuffer, pbSignature, szDescription.
-	// pbKeyBlob, and their lengths are used.
-
-	// The contents of the pbBuffer must be the same data
-	// that was originally signed.
-
-	//-------------------------------------------------------------------
-	// Get the public key of the user who created the digital signature
-	// and import it into the CSP by using CryptImportKey. This returns
-	// a handle to the public key in hPubKey.
-
-	/*if (CryptImportKey(
-	 hProv,
-	 pbKeyBlob,
-	 dwBlobLen,
-	 0,
-	 0,
-	 &hPubKey))
-	 {
-	 printf("The key has been imported.\n");
-	 }
-	 else
-	 {
-	 MyHandleError("Public key import failed.");
-	 }
-	 //-------------------------------------------------------------------
-	 // Create a new hash object.
-
-	 if (CryptCreateHash(
-	 hProv,
-	 CALG_MD5,
-	 0,
-	 0,
-	 &hHash))
-	 {
-	 printf("The hash object has been recreated. \n");
-	 }
-	 else
-	 {
-	 MyHandleError("Error during CryptCreateHash.");
-	 }
-	 //-------------------------------------------------------------------
-	 // Compute the cryptographic hash of the buffer.
-
-	 if (CryptHashData(
-	 hHash,
-	 pbBuffer,
-	 dwBufferLen,
-	 0))
-	 {
-	 printf("The new hash has been created.\n");
-	 }
-	 else
-	 {
-	 MyHandleError("Error during CryptHashData.");
-	 }
-	 //-------------------------------------------------------------------
-	 // Validate the digital signature.
-
-	 if (CryptVerifySignature(
-	 hHash,
-	 pbSignature,
-	 dwSigLen,
-	 hPubKey,
-	 NULL,
-	 0))
-	 {
-	 printf("The signature has been verified.\n");
-	 }
-	 else
-	 {
-	 printf("Signature not validated!\n");
-	 }
-	 //-------------------------------------------------------------------
-	 // Free memory to be used to store signature.
-
-
-
-	 //-------------------------------------------------------------------
-	 // Destroy the hash object.
-
-
-
-	 //-------------------------------------------------------------------
-	 // Release the provider handle.
-
-	 /*if (hProv)
-	 CryptReleaseContext(hProv, 0);*/
-	if (pbSignature) {
-		free(pbSignature);
-	}
-	return string(&buffer[0]);
-}
-} /* namespace license */
diff --git a/src/tools/base_lib/win/CryptoHelperWindows.h b/src/tools/base_lib/win/CryptoHelperWindows.h
deleted file mode 100644
index b4e7594..0000000
--- a/src/tools/base_lib/win/CryptoHelperWindows.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * CryptoHelperWindows.h
- *
- *  Created on: Sep 14, 2014
- *
- */
-
-#ifndef CRYPTOHELPERWINDOWS_H_
-#define CRYPTOHELPERWINDOWS_H_
-
-//#define _WIN32_WINNT 0x0400
-#include <windows.h>
-#include <wincrypt.h>
-#include <tchar.h>
-#include <string>
-#include "../CryptoHelper.h"
-
-
-
-namespace license {
-using namespace std;
-
-class CryptoHelperWindows: public CryptoHelper {
-private :
-	void acquireContext();
-	//	Handle to the cryptography provider.
-	HCRYPTPROV m_hCryptProv;
-	//	Handle to the cryptography key.
-	HCRYPTKEY m_hCryptKey;
-	void printHash(HCRYPTHASH* hHash) const;
-public:
-	CryptoHelperWindows();
-
-	virtual void generateKeyPair();
-	virtual const string exportPrivateKey() const;
-	virtual const string exportPublicKey() const;
-
-	virtual const string signString(const void* privateKey, size_t pklen,
-			const string& license) const;
-
-	virtual ~CryptoHelperWindows();
-};
-
-} /* namespace license */
-
-#endif /* CRYPTOHELPERWINDOWS_H_ */
diff --git a/src/tools/bootstrap/CMakeLists.txt b/src/tools/bootstrap/CMakeLists.txt
deleted file mode 100644
index 6bdf996..0000000
--- a/src/tools/bootstrap/CMakeLists.txt
+++ /dev/null
@@ -1,48 +0,0 @@
-add_executable(
- bootstrap
- bootstrap.cpp
-)
-
-#SET_TARGET_PROPERTIES(bootstrap PROPERTIES LINK_SEARCH_START_STATIC ON)
-SET_TARGET_PROPERTIES(bootstrap PROPERTIES LINK_SEARCH_END_STATIC OFF)
-target_link_libraries(
-     bootstrap
-     tools_base
-     ${EXTERNAL_LIBS}
-)
-
-if(MINGW)
-	#Cross compiling from linux host to windows
-	IF( ( CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux") AND CMAKE_CROSSCOMPILING)
-		#this is to avoid to install binfmt_misc (for builds in docker, or LXC)
-		add_custom_command (
-		  OUTPUT "${CMAKE_BINARY_DIR}/private-key.h" "${CMAKE_BINARY_DIR}/public-key.h"
-		  COMMAND wine ${CMAKE_CURRENT_BINARY_DIR}/bootstrap.exe "${CMAKE_BINARY_DIR}/private-key.h" "${CMAKE_BINARY_DIR}/public-key.h"
-		  WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
-		  DEPENDS bootstrap)
-	ELSE()
-		add_custom_command (
-		  OUTPUT "${CMAKE_BINARY_DIR}/private-key.h" "${CMAKE_BINARY_DIR}/public-key.h"
-		  COMMAND ./bootstrap.exe "${CMAKE_BINARY_DIR}/private-key.h" "${CMAKE_BINARY_DIR}/public-key.h"
-		  WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
-		  DEPENDS bootstrap)
-	ENDIF()
-else(MINGW)
-	add_custom_command (
-	  OUTPUT "${CMAKE_BINARY_DIR}/private-key.h" "${CMAKE_BINARY_DIR}/public-key.h"
-	  COMMAND bootstrap "${CMAKE_BINARY_DIR}/private-key.h" "${CMAKE_BINARY_DIR}/public-key.h"
-	  WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
-	  DEPENDS bootstrap)
-endif(MINGW)
-
-add_custom_target(private_key DEPENDS "${CMAKE_BINARY_DIR}/private-key.h")
-add_custom_target(public_key DEPENDS "${CMAKE_BINARY_DIR}/public-key.h")
-
-
-# add the command to generate the source code
-#add_custom_command (
-#  OUTPUT "${CMAKE_BINARY_DIR}/public-key.h" 
-#  COMMAND bootstrap derive_public "${CMAKE_CURRENT_SOURCE_DIR}/../license-generator/private-key.h" "${CMAKE_BINARY_DIR}/public-key.h"
-#  DEPENDS bootstrap private_key
-#)
-#add_custom_target(public_key DEPENDS "${CMAKE_BINARY_DIR}/public-key.h")
diff --git a/src/tools/bootstrap/bootstrap.cpp b/src/tools/bootstrap/bootstrap.cpp
deleted file mode 100644
index e3647de..0000000
--- a/src/tools/bootstrap/bootstrap.cpp
+++ /dev/null
@@ -1,104 +0,0 @@
-#include <stdio.h>
-#include "../base_lib/CryptoHelper.h"
-#include <string>
-#include <stdlib.h>
-#include <iostream> 
-#include <sys/stat.h>
-
-using namespace std;
-namespace license {
-
-void write_pubkey_file(const string& public_fname, const string& pbPublicKey) {
-	FILE* fp = fopen(public_fname.c_str(), "w");
-	if (fp == nullptr) {
-		throw ios_base::failure(string("can't create :") + public_fname);
-	}
-	fprintf(fp, "//file generated by bootstrap.cpp, do not edit.\n\n");
-	fprintf(fp, "#ifndef PUBLIC_KEY_H_\n#define PUBLIC_KEY_H_\n");
-	fprintf(fp, "#define PUBLIC_KEY { \\\n");
-	fprintf(fp, "%s", pbPublicKey.c_str());
-	fprintf(fp, "}\n\n");
-	const int random = rand() % 1000;
-	fprintf(fp, "#define SHARED_RANDOM %d;\n", random);
-	fprintf(fp, "#endif\n");
-	fclose(fp);
-}
-
-void write_privkey_file(const string& private_fname, const string& privateKey) {
-	FILE* fp = fopen(private_fname.c_str(), "w");
-	if (fp == nullptr) {
-		throw ios_base::failure(string("can't create :") + private_fname);
-	}
-	fprintf(fp, "//file generated by bootstrap.cpp, do not edit.\n\n");
-	fprintf(fp, "#ifndef PRIVATE_KEY_H_\n#define PRIVATE_KEY_H_\n");
-	fprintf(fp, "#define PRIVATE_KEY { \\\n");
-	fprintf(fp, "%s", privateKey.c_str());
-	fprintf(fp, "}\n\n");
-	fprintf(fp, "#endif\n");
-	fclose(fp);
-}
-
-void generatePk(string private_include, string public_include) {
-	unique_ptr<CryptoHelper> cryptoHlpr = CryptoHelper::getInstance();
-
-	try {
-		cryptoHlpr->generateKeyPair();
-	} catch (exception &e) {
-		cerr << endl << "Error generating key pair: " << e.what() << endl
-				<< "aborting" << endl;
-		exit(2);
-	}
-
-	try {
-		const string pubKey = cryptoHlpr->exportPublicKey();
-		write_pubkey_file(public_include, pubKey);
-		// Print out the public key to console as a
-		// hexadecimal string.
-		cout << endl << "PublicKey" << pubKey.c_str() << endl;
-	} catch (exception &e) {
-		cerr << endl << "Error exporting public key: " << e.what() << endl
-				<< "aborting." << endl;
-		exit(4);
-	}
-
-	try {
-		const string privKey = cryptoHlpr->exportPrivateKey();
-		write_privkey_file(private_include, privKey);
-	} catch (exception &e) {
-		cerr << endl << "Error exporting private key: " << e.what() << endl
-				<< "aborting" << endl;
-		exit(5);
-	}
-
-	return;
-}
-}
-
-bool file_exists (const std::string & name)
-{
-  struct stat buffer;
-  return (stat (name.c_str(), &buffer) == 0);
-}
-
-int main(int argc, char** argv) {
-
-	if (argc != 3) {
-		//print_usage();
-		exit(2);
-	} else {
-		printf("********************************************\n");
-		printf("*  Bootstrap!!!                            *\n");
-		printf("********************************************\n");
-
-	}
-	const string private_fname = string(argv[1]);
-	const string public_fname(argv[2]);
-
-	if (file_exists(private_fname) || file_exists(public_fname)) {
-		printf("Key files exist, skipping key generation. Do 'make clean' to generate new keys.\n");
-		exit(0);
-	}
-
-	license::generatePk(private_fname, public_fname);
-	return 0;
-}
diff --git a/src/tools/license-generator/.gitignore b/src/tools/license-generator/.gitignore
deleted file mode 100644
index 3190db4..0000000
--- a/src/tools/license-generator/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/private-key.h
diff --git a/src/tools/license-generator/CMakeLists.txt b/src/tools/license-generator/CMakeLists.txt
deleted file mode 100644
index 334b178..0000000
--- a/src/tools/license-generator/CMakeLists.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-include_directories(${Boost_INCLUDE_DIR})
-include_directories(${CMAKE_CURRENT_BINARY_DIR})
-link_directories ( ${Boost_LIBRARY_DIR} )
-
-ADD_LIBRARY(
-    license_generator_lib STATIC
-    license-generator.cpp
-)
-
-target_link_libraries(
-     license_generator_lib
-     tools_base
-     base
-     licensecc_static
-	 $<$<CONFIG:Debug>:${Boost_PROGRAM_OPTIONS_LIBRARY_DEBUG}>
-     $<$<NOT:$<CONFIG:Debug>>:${Boost_PROGRAM_OPTIONS_LIBRARY_RELEASE}>	 
-	 $<$<CONFIG:Debug>:${Boost_SYSTEM_LIBRARY_DEBUG}>
-     $<$<NOT:$<CONFIG:Debug>>:${Boost_SYSTEM_LIBRARY_RELEASE}>	 
-     ${EXTERNAL_LIBS}
-)
-
-add_executable(
- license_generator
- license-generator-main.cpp
-)
-
-target_link_libraries(
-    license_generator
-    license_generator_lib
-)
-add_dependencies( license_generator private_key )
-
-install(TARGETS license_generator RUNTIME DESTINATION bin)
-
diff --git a/src/tools/license-generator/license-generator-main.cpp b/src/tools/license-generator/license-generator-main.cpp
deleted file mode 100644
index 39dc455..0000000
--- a/src/tools/license-generator/license-generator-main.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <stdlib.h>
-#include "license-generator.h"
-
-int main(int argc, const char *argv[]) {
-	 return license::LicenseGenerator::generateLicense(argc, argv);
-
-}
-
diff --git a/src/tools/license-generator/license-generator.cpp b/src/tools/license-generator/license-generator.cpp
deleted file mode 100644
index d7335cf..0000000
--- a/src/tools/license-generator/license-generator.cpp
+++ /dev/null
@@ -1,249 +0,0 @@
-#include "license-generator.h"
-
-#include <stddef.h>
-#include <stdlib.h>
-#include <cerrno>
-#include <cstdio>
-#include <cstring>
-#include <ctime>
-#include <fstream>
-#include <iomanip>
-#include <iostream>
-#include <iterator>
-#include <map>
-#include <memory>
-#include <regex>
-#include <sstream>
-#include <stdexcept>
-#include <string>
-#include <vector>
-#include <boost/program_options.hpp>
-#include <boost/algorithm/string.hpp>
-
-#include <private-key.h>
-#include <build_properties.h>
-#include "../../library/base/base64.h"
-#include "../base_lib/CryptoHelper.h"
-
-//namespace fs = boost::filesystem;
-//namespace bt = boost::posix_time;
-namespace po = boost::program_options;
-
-using namespace std;
-
-namespace license {
-
-void LicenseGenerator::printHelp(const char *prog_name,
-		const po::options_description &options) {
-	cout << endl;
-	cout << prog_name << " Version " << PROJECT_VERSION << endl << ". Usage:"
-			<< endl;
-	cout << prog_name << " [options] product_name1 product_name2 ... " << endl
-			<< endl;
-	cout
-			<< " product_name1 ... = Product name. This string must match the one passed by the software."
-			<< endl;
-	cout << options << endl;
-}
-
-po::options_description LicenseGenerator::configureProgramOptions() {
-	po::options_description common("General options");
-	common.add_options()("help,h", "print help message and exit.") //
-	("verbose,v", "print more information.")//
-
-	("output,o", po::value<string>(), "Output file name. If not specified the "
-			"license will be printed to standard output");
-	po::options_description licenseGeneration("License Generation");
-	licenseGeneration.add_options()("private_key,p", po::value<string>(),
-			"Specify an alternate file for the primary key to be used. "
-					"If not specified the internal primary key will be used.")(
-			"begin_date,b", po::value<string>(),
-			"Specify the start of the validity for this license. "
-					" Format YYYYMMDD. If not specified defaults to today")(
-			"expire_date,e", po::value<string>(),
-			"Specify the expire date for this license. "
-					" Format YYYYMMDD. If not specified the license won't expire")(
-			"client_signature,s", po::value<string>(),
-			"The signature of the pc that requires the license. "
-					"It should be in the format XXXX-XXXX-XXXX-XXXX."
-					" If not specified the license "
-					"won't be linked to a specific pc.")("start_version,t",
-			po::value<unsigned int>()->default_value(0
-			/*FullLicenseInfo.UNUSED_SOFTWARE_VERSION*/, "All Versions"),
-			"Specify the first version of the software this license apply to.")(
-			"end_version,n", po::value<unsigned int>()->default_value(0
-			/*FullLicenseInfo.UNUSED_SOFTWARE_VERSION*/, "All Versions"),
-			"Specify the last version of the software this license apply to.")(
-			"extra_data,x", po::value<string>(),
-			"Specify extra data to be included into the license");
-	po::options_description visibleOptions;
-	visibleOptions.add(common).add(licenseGeneration);
-	return visibleOptions;
-}
-
-vector<FullLicenseInfo> LicenseGenerator::parseLicenseInfo(
-		const po::variables_map &vm) {
-	string begin_date = FullLicenseInfo::UNUSED_TIME;
-	string end_date = FullLicenseInfo::UNUSED_TIME;
-	if (vm.count("expire_date")) {
-		const std::string dt_end = vm["expire_date"].as<string>();
-		try {
-			end_date = normalize_date(dt_end);
-			char curdate[20];
-			time_t curtime = time(nullptr);
-			strftime(curdate, 20, "%Y-%m-%d", localtime(&curtime));
-			begin_date.assign(curdate);
-		} catch (const invalid_argument &e) {
-			cerr << endl << "End date not recognized: " << dt_end
-					<< " Please enter a valid date in format YYYYMMDD" << endl;
-			exit(2);
-		}
-	}
-	if (vm.count("begin_date")) {
-		const std::string begin_date_str = vm["begin_date"].as<string>();
-		try {
-			begin_date = normalize_date(begin_date_str);
-		} catch (invalid_argument &e) {
-			cerr << endl << "Begin date not recognized: " << begin_date_str
-					<< " Please enter a valid date in format YYYYMMDD" << endl;
-			//print_usage(vm);
-			exit(2);
-		}
-	}
-	string client_signature = "";
-	if (vm.count("client_signature")) {
-		client_signature = vm["client_signature"].as<string>();
-		cout << "cli sig:" << client_signature;
-		regex e(
-				"[A-Za-z0-9\\+/]{4}-[A-Za-z0-9\\+/]{4}-[A-Za-z0-9\\+/]{4}-[A-Za-z0-9\\+/]{4}");
-		cout << "\nregex:";
-		if (!regex_match(client_signature, e)) {
-			cerr << endl << "Client signature not recognized: "
-					<< client_signature
-					<< " Please enter a valid signature in format XXXX-XXXX-XXXX-XXXX"
-					<< endl;
-			exit(2);
-		}
-	}
-	string extra_data = "";
-	if (vm.count("extra_data")) {
-		extra_data = vm["extra_data"].as<string>();
-	}
-	unsigned int from_sw_version = vm["start_version"].as<unsigned int>();
-	unsigned int to_sw_version = vm["end_version"].as<unsigned int>();
-	if (vm.count("product") == 0) {
-		cerr << endl << "Parameter [product] not found. " << endl;
-		exit(2);
-	}
-	vector<string> products = vm["product"].as<vector<string>>();
-	vector<FullLicenseInfo> licInfo;
-	licInfo.reserve(products.size());
-	for (auto it = products.begin(); it != products.end(); it++) {
-		if (boost::algorithm::trim_copy(*it).length() > 0) {
-			licInfo.push_back(
-					FullLicenseInfo("", *it, "", PROJECT_INT_VERSION,
-							begin_date, end_date, client_signature,
-							from_sw_version, to_sw_version, extra_data));
-		}
-	}
-	return licInfo;
-}
-
-void LicenseGenerator::generateAndOutputLicenses(const po::variables_map &vm,
-		ostream &outputFile) {
-	vector<FullLicenseInfo> licenseInfo = parseLicenseInfo(vm);
-	const unique_ptr<CryptoHelper> helper = CryptoHelper::getInstance();
-	const unsigned char pkey[] = PRIVATE_KEY;
-	const size_t len = sizeof(pkey);
-	for (auto it = licenseInfo.begin(); it != licenseInfo.end(); ++it) {
-		const string license = it->printForSign();
-		const string signature = helper->signString((const void*) pkey, len,
-				license);
-		it->license_signature = signature;
-		it->printAsIni(outputFile);
-	}
-}
-
-void LicenseGenerator::generateB64Licenses(const po::variables_map &vm,
-		ostream &outputFile) {
-	std::ostringstream tempStream;
-	generateAndOutputLicenses(vm, tempStream);
-
-	std::string str = tempStream.str();
-	const char *chr = str.c_str();
-	int finalLenght;
-	char *encoded = base64(chr, str.length(), &finalLenght);
-	outputFile.write(encoded, finalLenght);
-	free(encoded);
-}
-
-int LicenseGenerator::generateLicense(int argc, const char **argv) {
-
-	po::options_description visibleOptions = configureProgramOptions();
-	//positional options must be added to standard options
-	po::options_description allOptions;
-	allOptions.add(visibleOptions).add_options()("product",
-			po::value<vector<string>>(), "product names");
-
-	po::positional_options_description p;
-	p.add("product", -1);
-
-	po::variables_map vm;
-	po::store(
-			po::command_line_parser(argc, argv).options(allOptions).positional(
-					p).run(), vm);
-	po::notify(vm);
-	if (vm.count("help") || argc == 1) {
-		printHelp(argv[0], visibleOptions);
-		return 0;
-	}
-
-	if (vm.count("output")) {
-		const std::string fname = vm["output"].as<string>();
-
-		fstream ofstream(fname, std::ios::out | std::ios::app);
-		if (!ofstream.is_open()) {
-			cerr << "can't open file [" << fname << "] for output." << endl
-					<< " error: " << strerror(errno) << endl;
-			exit(3);
-		}
-		if (vm.count("base64")) {
-			generateB64Licenses(vm, ofstream);
-		} else {
-			generateAndOutputLicenses(vm, ofstream);
-		}
-		ofstream.close();
-	} else {
-		if (vm.count("base64")) {
-			generateB64Licenses(vm, cout);
-		} else {
-			generateAndOutputLicenses(vm, cout);
-		}
-	}
-	return 0;
-}
-
-const std::string formats[] = { "%4u-%2u-%2u", "%4u/%2u/%2u", "%4u%2u%2u" };
-const size_t formats_n = 3;
-
-string LicenseGenerator::normalize_date(const std::string &sDate) {
-	if (sDate.size() < 8)
-		throw invalid_argument("Date string too small for known formats");
-	unsigned int year, month, day;
-	bool found = false;
-	for (size_t i = 0; i < formats_n && !found; ++i) {
-		const int chread = sscanf(sDate.c_str(), formats[i].c_str(), &year,
-				&month, &day);
-		if (chread == 3) {
-			found = true;
-			break;
-		}
-	}
-	if (!found)
-		throw invalid_argument("Date string did not match a known format");
-	ostringstream oss;
-	oss << year << "-" << setfill('0') << std::setw(2) << month << "-"
-			<< setfill('0') << std::setw(2) << day;
-	return oss.str();
-}
-}
diff --git a/src/tools/license-generator/license-generator.h b/src/tools/license-generator/license-generator.h
deleted file mode 100644
index 04eaee6..0000000
--- a/src/tools/license-generator/license-generator.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * LicenseSigner.h
- *
- *  Created on: Apr 6, 2014
- *
- */
-
-#ifndef LICENSE_GENERATOR_H_
-#define LICENSE_GENERATOR_H_
-
-#include <boost/program_options.hpp>
-#include "../../library/LicenseReader.hpp"
-
-namespace license {
-
-namespace po = boost::program_options;
-/**
- * This class contains all the logic used to generate a new license.
- * Since it has no method "main", can be easily used in unit tests.
- */
-class LicenseGenerator {
-private:
-	LicenseGenerator();
-
-	static void printHelp(const char* prog_name, const po::options_description& options);
-	static po::options_description configureProgramOptions();
-	static std::vector<FullLicenseInfo> parseLicenseInfo(const po::variables_map& vm);
-	static void generateAndOutputLicenses(const po::variables_map& vm,
-			std::ostream& outputFile);
-	static void generateB64Licenses(const po::variables_map& vm,
-			std::ostream& outputFile);
-	static std::string normalize_date(const std::string& s);
-public:
-	/**
-	 * Available options:
-	 * <ul>
-	 * 	<li>-s : use Client Signature.</li>
-	 * </ul>
-	 * @param argc
-	 * 			count of arguments.
-	 * @param argv
-	 * 			char** of parameters.
-	 * @return
-	 */
-	static int generateLicense(int argc, const char** argv);
-};
-
-} /* namespace license */
-
-#endif /* LICENSE_GENERATOR_H_ */
diff --git a/src/tools/pc-identifier/CMakeLists.txt b/src/tools/pc-identifier/CMakeLists.txt
deleted file mode 100644
index 7cb985b..0000000
--- a/src/tools/pc-identifier/CMakeLists.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-
-#set_target_properties(ui PROPERTIES LINK_FLAGS "-static")
\ No newline at end of file
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 0fb6853..58bc28c 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -4,5 +4,4 @@
 link_directories ( ${Boost_LIBRARY_DIR} )
 
 add_subdirectory(library)
-add_subdirectory(license-generator)
 add_subdirectory(functional)
\ No newline at end of file
diff --git a/test/functional/CMakeLists.txt b/test/functional/CMakeLists.txt
index 44b4a8d..0dd0a42 100644
--- a/test/functional/CMakeLists.txt
+++ b/test/functional/CMakeLists.txt
@@ -43,7 +43,7 @@
  ${Boost_LIBRARIES}
 )
 
-
+#set CROSSCOMPILING_EMULATOR
 IF( ( CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux") AND CMAKE_CROSSCOMPILING)
 #binfmt_misc doesn't work in my system :(
 	ADD_TEST(NAME test_standard_license COMMAND wine ${CMAKE_CURRENT_BINARY_DIR}/test_standard_license WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
diff --git a/test/license-generator/CMakeLists.txt b/test/license-generator/CMakeLists.txt
deleted file mode 100644
index f50b2ea..0000000
--- a/test/license-generator/CMakeLists.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-
-add_executable(
- license_generator_test
- license-generator_test.cpp
-)
-
-target_link_libraries(
- license_generator_test
- license_generator_lib
- ${Boost_LIBRARIES}
-)
-
-IF( ( CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux") AND CMAKE_CROSSCOMPILING)
-	ADD_TEST(NAME license_generator_test COMMAND wine ${CMAKE_CURRENT_BINARY_DIR}/license_generator_test WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
-ELSE()
-	ADD_TEST(NAME license_generator_test COMMAND license_generator_test WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
-ENDIF()
diff --git a/test/license-generator/license-generator_test.cpp b/test/license-generator/license-generator_test.cpp
deleted file mode 100644
index 4e8c6ec..0000000
--- a/test/license-generator/license-generator_test.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-#define BOOST_TEST_MODULE license_generator_test
-//#define BOOST_TEST_MAIN
-//#define BOOST_TEST_DYN_LINK
-#include <boost/test/unit_test.hpp>
-#include <boost/filesystem.hpp>
-#include <build_properties.h>
-
-#include "../../src/tools/license-generator/license-generator.h"
-#include "../../src/library/ini/SimpleIni.h"
-
-namespace fs = boost::filesystem;
-using namespace license;
-using namespace std;
-
-void generate_license(const string& prod_name, const string& fname) {
-	const int argc = 4;
-	const char** argv = new const char*[argc + 1];
-	argv[0] = "lic-generator";
-	argv[1] = "-o";
-	argv[2] = fname.c_str();
-	argv[3] = "test";
-	const int retCode = LicenseGenerator::generateLicense(argc, argv);
-	delete[] (argv);
-	BOOST_CHECK_EQUAL(retCode, 0);
-	BOOST_ASSERT(fs::exists(fname));
-	CSimpleIniA ini;
-	const SI_Error rc = ini.LoadFile(fname.c_str());
-	BOOST_CHECK_GE(rc,0);
-	const int sectionSize = ini.GetSectionSize(prod_name.c_str());
-	BOOST_CHECK_GT(sectionSize,0);
-}
-
-BOOST_AUTO_TEST_CASE( generate_lic_file ) {
-	const string licLocation(PROJECT_TEST_TEMP_DIR "/test1.lic");
-	generate_license(string("TEST"), licLocation);
-}
-

--
Gitblit v1.9.1