build,logic : Key/License Generator
Generator using the Botan Cyrptography library
This commit is contained in:
committed by
Eberhard Graether
parent
743f91e882
commit
23257a3071
@@ -0,0 +1,45 @@
|
||||
SET(BOTAN_URL https://github.com/randombit/botan.git/)
|
||||
SET(BOTAN_VERSION 1.11.23)
|
||||
SET(BOTAN_MODULES "base,ecdsa,emsa1,passhash9,rng,rsa,egd,emsa_pssr,emsa_pkcs1,x509,aes,dev_random")
|
||||
|
||||
SET(BOTAN_DIR $ENV{COATI_DEPEND_DIR}/botan)
|
||||
|
||||
find_package(Git)
|
||||
|
||||
if(Git_FOUND)
|
||||
else()
|
||||
message(ERROR "git not found: git not in path")
|
||||
endif()
|
||||
|
||||
if(EXISTS $ENV{COATI_DEPEND_DIR})
|
||||
else()
|
||||
message(ERROR "coati dependency directory does not exist")
|
||||
endif()
|
||||
|
||||
if(EXISTS ${BOTAN_DIR})
|
||||
else()
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} clone ${BOTAN_URL}
|
||||
WORKING_DIRECTORY $ENV{COATI_DEPEND_DIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} checkout ${BOTAN_VERSION}
|
||||
WORKING_DIRECTORY ${BOTAN_DIR}
|
||||
)
|
||||
|
||||
# system specific botan modules
|
||||
if(UNIX)
|
||||
|
||||
elseif(MSVC)
|
||||
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND ./configure.py --gen-amalgamation --minimized-build --enable-modules=${BOTAN_MODULES}
|
||||
WORKING_DIRECTORY ${BOTAN_DIR}
|
||||
)
|
||||
|
||||
#linux
|
||||
#./configure.py --gen-amalgamation --minimized-build --enable-modules=base,ecdsa,emsa1,passhash9,rng,rsa,egd,dev_random,emsa_pssr,emsa_pkcs1,x509,aes
|
||||
@@ -8,7 +8,6 @@ else()
|
||||
set(CLANG_BUILD_PATH "$ENV{CLANG_DIR}/build")
|
||||
endif()
|
||||
|
||||
|
||||
execute_process(
|
||||
COMMAND ${CLANG_BUILD_PATH}/bin/llvm-config --cxxflags
|
||||
OUTPUT_VARIABLE CLANG_DEFINITIONS
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
#ifndef PUBLIC_KEY_H
|
||||
#define PUBLIC_KEY_H
|
||||
|
||||
// This File(PublicKey.h) is generated with CMake
|
||||
|
||||
#include <string>
|
||||
|
||||
static const std::string PublicKey = "@KEY@";
|
||||
|
||||
#endif //PUBLIC_KEY_H
|
||||
@@ -26,6 +26,7 @@ AddLicense("Boost" "http://www.boost.org" "${LICENSEFOLDER}/boost_LICENSE.TXT" f
|
||||
AddLicense("TinyXMl" "http://www.grinninglizard.com/tinyxml2/" "${LICENSEFOLDER}/tinyxml_LICENSE.TXT" false)
|
||||
AddLicense("CppSQLite" "http://www.codeproject.com/Articles/6343/CppSQLite-C-Wrapper-for-SQLite" "${LICENSEFOLDER}/CppSQLite_LICENSE.TXT" false)
|
||||
AddLicense("Eigen" "http://eigen.tuxfamily.org" "${LICENSEFOLDER}/eigen_LICENSE.TXT" false)
|
||||
AddLicense("Botan" "http://botan.randombit.net/" "${LICENSEFOLDER}/botan_LICENSE.TXT" true)
|
||||
|
||||
set(LICENSE_ARRAY "${LICENSE_ARRAY}\n")
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
# searching for public key file of the Coati version in setup/RSA_keys
|
||||
# if found the file will be put into a const string into the PubicKeh.h file
|
||||
|
||||
string(REGEX REPLACE "^([0-9]+)\\..*" "\\1" VERSION_MAJOR "${GIT_VERSION_NUMBER}")
|
||||
message(STATUS "Get Public Key for Coati version: ${VERSION_MAJOR}")
|
||||
|
||||
set(pubKeyFile "${CMAKE_SOURCE_DIR}/setup/RSA_keys/public-${VERSION_MAJOR}.pem")
|
||||
# message(STATUS "file: ${pubKeyFile}")
|
||||
|
||||
if(EXISTS ${pubKeyFile})
|
||||
file(READ ${pubKeyFile} KEY)
|
||||
STRING(REGEX REPLACE "\"" "\\\\\"" KEY "${KEY}")
|
||||
STRING(REGEX REPLACE "\n" "\\\\n\"\n\t\"" KEY "${KEY}")
|
||||
# message(STATUS "key: ${KEY}")
|
||||
else()
|
||||
message(WARNING "public keyfile for this version of Coati")
|
||||
endif()
|
||||
|
||||
configure_file(
|
||||
${CMAKE_SOURCE_DIR}/cmake/PublicKey.h.in
|
||||
${CMAKE_SOURCE_DIR}/build/src/app/PublicKey.h
|
||||
)
|
||||
Reference in New Issue
Block a user