From 5400aab071aa0fd63e333e89a0d151ad39deb1a0 Mon Sep 17 00:00:00 2001 From: Viktor Kreschenski Date: Wed, 4 Sep 2019 18:22:42 +0200 Subject: [PATCH 1/7] Updated installation and fixed minor bugs --- README.md | 17 +++++++++-------- cmake/FindCryptoPP.cmake | 8 ++++---- cmake/Findgtest.cmake | 2 +- sample/README.md | 12 ++++++++++-- src/external/Ripe.cc | 6 +++--- 5 files changed, 27 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 86b161b..a4d8345 100644 --- a/README.md +++ b/README.md @@ -32,25 +32,26 @@ License++ is software licensing library that provides an abstract way to secure * [Download](https://github.com/zuhd-org/licensepp/archive/master.zip) or [clone](git@github.com:zuhd-org/licensepp.git) the repository * Install Crypto++ ``` - wget https://muflihun.github.io/downloads/cryptocpp.tar.gz - tar xf cryptocpp.tar.gz - cd cryptopp-CRYPTOPP_5_6_5 - wget https://muflihun.github.io/downloads/pem_pack.zip - unzip pem_pack.zip - cmake . + git clone https://github.com/zuhd-org/licensepp + git clone https://github.com/weidai11/cryptopp.git + git clone https://github.com/noloader/cryptopp-pem.git + cp cryptopp-pem/* cryptopp/ + cd cryptopp make - make install + sudo make install ``` * Use CMake to build the project ``` - cd + cd licensepp mkdir build cd build cmake .. + make make install ## build with test cmake -Dtest=ON .. + make make install ./licensepp-unit-tests ``` diff --git a/cmake/FindCryptoPP.cmake b/cmake/FindCryptoPP.cmake index b654ae1..329134b 100644 --- a/cmake/FindCryptoPP.cmake +++ b/cmake/FindCryptoPP.cmake @@ -93,14 +93,14 @@ IF (CRYPTOPP_INCLUDE_DIR) STRING (REGEX REPLACE "^#define CRYPTOPP_VERSION[ \t]+([0-9]+)" "\\1" _CRYPTOPP_VERSION_TMP - ${_CRYPTOPP_VERSION_TMP}) + "${_CRYPTOPP_VERSION_TMP}") STRING (REGEX REPLACE "([0-9]+)[0-9][0-9]" "\\1" CRYPTOPP_VERSION_MAJOR - ${_CRYPTOPP_VERSION_TMP}) + "${_CRYPTOPP_VERSION_TMP}") STRING (REGEX REPLACE "[0-9]([0-9])[0-9]" "\\1" CRYPTOPP_VERSION_MINOR - ${_CRYPTOPP_VERSION_TMP}) + "${_CRYPTOPP_VERSION_TMP}") STRING (REGEX REPLACE "[0-9][0-9]([0-9])" "\\1" CRYPTOPP_VERSION_PATCH - ${_CRYPTOPP_VERSION_TMP}) + "${_CRYPTOPP_VERSION_TMP}") SET (CRYPTOPP_VERSION_COUNT 3) SET (CRYPTOPP_VERSION diff --git a/cmake/Findgtest.cmake b/cmake/Findgtest.cmake index cd443f4..4698f25 100644 --- a/cmake/Findgtest.cmake +++ b/cmake/Findgtest.cmake @@ -79,7 +79,7 @@ function(GTEST_ADD_TESTS executable extra_args) file(READ "${source}" contents) string(REGEX MATCHALL "TEST_?F?\\(([A-Za-z_0-9 ,]+)\\)" found_tests ${contents}) foreach(hit ${found_tests}) - string(REGEX REPLACE ".*\\( *([A-Za-z_0-9]+), *([A-Za-z_0-9]+) *\\).*" "\\1.\\2" test_name ${hit}) + string(REGEX REPLACE ".*\\( *([A-Za-z_0-9]+), *([A-Za-z_0-9]+) *\\).*" "\\1.\\2" test_name "${hit}") add_test(${test_name} ${executable} --gtest_filter=${test_name} ${extra_args}) list(APPEND _test_names ${test_name}) endforeach() diff --git a/sample/README.md b/sample/README.md index 8e2eaed..6da6758 100644 --- a/sample/README.md +++ b/sample/README.md @@ -3,9 +3,17 @@ After you build using `make` run: ``` -./license-manager-sample --license sample.licensepp +LD_LIBRARY_PATH=/usr/local/lib/ ./license-manager-sample --license sample.licensepp +``` +or +``` +LD_LIBRARY_PATH=../build ./license-manager-sample --license sample.licensepp ``` ``` -./license-manager-sample --license sample-with-signature.licensepp --signature sample-signature +LD_LIBRARY_PATH=/usr/local/lib/ ./license-manager-sample --license sample-with-signature.licensepp --signature sample-signature +``` +or +``` +LD_LIBRARY_PATH=../build ./license-manager-sample --license sample-with-signature.licensepp --signature sample-signature ``` diff --git a/src/external/Ripe.cc b/src/external/Ripe.cc index 8709256..035c663 100644 --- a/src/external/Ripe.cc +++ b/src/external/Ripe.cc @@ -144,7 +144,7 @@ bool Ripe::verifyRSA(const std::string& data, const std::string& signatureHex, c } std::string decodedSignature = Ripe::hexToString(signatureHex); bool result = false; - RSASS::Verifier verifier(publicKey); + RSASS::Verifier verifier(publicKey); StringSource ss2(decodedSignature + data, true, new SignatureVerificationFilter(verifier, new ArraySink((RipeByte*)&result, sizeof(result)))); @@ -161,7 +161,7 @@ std::string Ripe::signRSA(const std::string& data, const std::string& privateKey // sign message std::string signature; - RSASS::Signer signer(privateKey); + RSASS::Signer signer(privateKey); AutoSeededRandomPool rng; StringSource ss(data, true, @@ -227,7 +227,7 @@ Ripe::KeyPair Ripe::generateRSAKeyPair(unsigned int length, const std::string& s if (secret.empty()) { PEM_Save(snk, privateKey); } else { - PEM_Save(snk, rng, privateKey, PRIVATE_RSA_ALGORITHM, secret.data(), secret.size()); + PEM_Save(snk, privateKey, rng, PRIVATE_RSA_ALGORITHM, secret.data(), secret.size()); } snk.MessageEnd(); } From b58291510fb27b5028450ea9d84b97e68f09df1f Mon Sep 17 00:00:00 2001 From: Viktor Kreschenski Date: Wed, 4 Sep 2019 18:24:54 +0200 Subject: [PATCH 2/7] Added sudo for make install --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a4d8345..a973abe 100644 --- a/README.md +++ b/README.md @@ -47,12 +47,12 @@ License++ is software licensing library that provides an abstract way to secure cd build cmake .. make - make install + sudo make install ## build with test cmake -Dtest=ON .. make - make install + sudo make install ./licensepp-unit-tests ``` * You can build [cli](/cli) tool to ensure license++ is installed properly From 06ef6481a03b6b7cbcd37f5812ff83800ecacfff Mon Sep 17 00:00:00 2001 From: Viktor Kreschenski Date: Wed, 4 Sep 2019 18:27:33 +0200 Subject: [PATCH 3/7] Added into sample readme normal execution --- sample/README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sample/README.md b/sample/README.md index 6da6758..5c490e9 100644 --- a/sample/README.md +++ b/sample/README.md @@ -2,6 +2,10 @@ After you build using `make` run: +``` +./license-manager-sample --license sample.licensepp +``` +or ``` LD_LIBRARY_PATH=/usr/local/lib/ ./license-manager-sample --license sample.licensepp ``` @@ -10,6 +14,10 @@ or LD_LIBRARY_PATH=../build ./license-manager-sample --license sample.licensepp ``` +``` +./license-manager-sample --license sample-with-signature.licensepp --signature sample-signature +``` +or ``` LD_LIBRARY_PATH=/usr/local/lib/ ./license-manager-sample --license sample-with-signature.licensepp --signature sample-signature ``` From 63639eb8ab8adc18cef44a7ccf8fe7447e16a813 Mon Sep 17 00:00:00 2001 From: Viktor Kreschenski Date: Wed, 4 Sep 2019 18:35:15 +0200 Subject: [PATCH 4/7] Update travis --- .travis.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index ddb7702..9855f9e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -95,12 +95,11 @@ install: - cd .. ## Crypto++ (We dont need this for residue, we need it for ripe and mine) - - wget https://muflihun.github.io/downloads/cryptocpp.tar.gz - - tar xf cryptocpp.tar.gz - - cd cryptopp-CRYPTOPP_5_6_5 - - wget https://muflihun.github.io/downloads/pem_pack.zip - - unzip pem_pack.zip - - cmake . + - git clone https://github.com/zuhd-org/licensepp + - git clone https://github.com/weidai11/cryptopp.git + - git clone https://github.com/noloader/cryptopp-pem.git + - cp cryptopp-pem/* cryptopp/ + - cd cryptopp - make - sudo make install From dee5993959a0e8e220bd578526544459e1e269c7 Mon Sep 17 00:00:00 2001 From: Viktor Kreschenski Date: Wed, 4 Sep 2019 18:37:40 +0200 Subject: [PATCH 5/7] Removed sudo make --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9855f9e..17c27cb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -111,7 +111,7 @@ install: - sudo make - sudo make install - cmake -Dtest=ON -Dtravis=ON .. - - sudo make + - make - sudo make install - export LD_LIBRARY_PATH=/usr/local/lib - ls -l From 318801923d53c3d18c4bfe4e315aa63c93402ab1 Mon Sep 17 00:00:00 2001 From: Viktor Kreschenski Date: Thu, 5 Sep 2019 09:48:17 +0200 Subject: [PATCH 6/7] Remove cloning and add sudo make again --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 17c27cb..8264b00 100644 --- a/.travis.yml +++ b/.travis.yml @@ -95,7 +95,6 @@ install: - cd .. ## Crypto++ (We dont need this for residue, we need it for ripe and mine) - - git clone https://github.com/zuhd-org/licensepp - git clone https://github.com/weidai11/cryptopp.git - git clone https://github.com/noloader/cryptopp-pem.git - cp cryptopp-pem/* cryptopp/ @@ -111,7 +110,7 @@ install: - sudo make - sudo make install - cmake -Dtest=ON -Dtravis=ON .. - - make + - sudo make - sudo make install - export LD_LIBRARY_PATH=/usr/local/lib - ls -l From d31f919e8e7417232a83ea13fcf19b2730a32d9a Mon Sep 17 00:00:00 2001 From: Majid Date: Fri, 24 Jan 2020 22:53:51 +1100 Subject: [PATCH 7/7] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8264b00..fbe797e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -96,7 +96,7 @@ install: ## Crypto++ (We dont need this for residue, we need it for ripe and mine) - git clone https://github.com/weidai11/cryptopp.git - - git clone https://github.com/noloader/cryptopp-pem.git + - git clone https://github.com/amraynweb/cryptopp-pem.git - cp cryptopp-pem/* cryptopp/ - cd cryptopp - make