Skip to content

Commit

Permalink
Merge pull request #26 from vkresch/master
Browse files Browse the repository at this point in the history
Update installation and fixing minor bugs
  • Loading branch information
abumq authored Jan 24, 2020
2 parents 1b33f89 + bdca3fe commit b225797
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 24 deletions.
10 changes: 4 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,10 @@ install:
- cd ..

## Crypto++ (We dont need this for residue, we need it for ripe and mine)
- wget https://amrayn.github.io/downloads/cryptocpp.tar.gz
- tar xf cryptocpp.tar.gz
- cd cryptopp-CRYPTOPP_5_6_5
- wget https://amrayn.github.io/downloads/pem_pack.zip
- unzip pem_pack.zip
- cmake .
- git clone https://github.com/weidai11/cryptopp.git
- git clone https://github.com/amraynweb/cryptopp-pem.git
- cp cryptopp-pem/* cryptopp/
- cd cryptopp
- make
- sudo make install

Expand Down
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,27 @@ License++ is software licensing library that provides an abstract way to secure
* [Download](https://github.com/amrayn/licensepp/archive/master.zip) or [clone]([email protected]:amrayn/licensepp.git) the repository
* Install Crypto++
```
wget https://amrayn.github.io/downloads/cryptocpp.tar.gz
tar xf cryptocpp.tar.gz
cd cryptopp-CRYPTOPP_5_6_5
wget https://amrayn.github.io/downloads/pem_pack.zip
unzip pem_pack.zip
cmake .
git clone https://github.com/amrayn/licensepp
git clone https://github.com/weidai11/cryptopp.git
git clone https://github.com/amraynweb/cryptopp-pem.git
cp cryptopp-pem/* cryptopp/
cd cryptopp
make
make install
sudo make install
```
* Use CMake to build the project
```
cd <project_root>
cd licensepp
mkdir build
cd build
cmake ..
make install
make
sudo make install
## build with test
cmake -Dtest=ON ..
make install
make
sudo make install
./licensepp-unit-tests
```
* You can build [cli](/cli) tool to ensure license++ is installed properly
Expand Down
8 changes: 4 additions & 4 deletions cmake/FindCryptoPP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cmake/Findgtest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
16 changes: 16 additions & 0 deletions sample/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,23 @@ 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
```
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
```
or
```
LD_LIBRARY_PATH=../build ./license-manager-sample --license sample-with-signature.licensepp --signature sample-signature
```
6 changes: 3 additions & 3 deletions src/external/Ripe.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<PKCS1v15,SHA>::Verifier verifier(publicKey);
RSASS<PKCS1v15,SHA1>::Verifier verifier(publicKey);
StringSource ss2(decodedSignature + data, true,
new SignatureVerificationFilter(verifier,
new ArraySink((RipeByte*)&result, sizeof(result))));
Expand All @@ -161,7 +161,7 @@ std::string Ripe::signRSA(const std::string& data, const std::string& privateKey

// sign message
std::string signature;
RSASS<PKCS1v15,SHA>::Signer signer(privateKey);
RSASS<PKCS1v15,SHA1>::Signer signer(privateKey);
AutoSeededRandomPool rng;

StringSource ss(data, true,
Expand Down Expand Up @@ -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();
}
Expand Down

0 comments on commit b225797

Please sign in to comment.