-
-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from muflihun/develop
v1.0.0
- Loading branch information
Showing
13 changed files
with
1,915 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,22 +14,42 @@ License++ is software licensing library that provides an abstract way to secure | |
## Features | ||
|
||
* RSA-Based signing to prevent alteration | ||
* Custom issuing authority for your software | ||
* Anyone can validate the license but not everyone can issue new licenses | ||
* Expiring issuing authority | ||
* Custom license keys for your software | ||
* Anyone can check the license validity | ||
* Restricted issuance of new licenses | ||
* Disable issuing authority at anytime | ||
|
||
## Getting Started | ||
|
||
### Dependencies | ||
|
||
* C++11 | ||
* [Crypto++](https://www.cryptopp.com/) v5.6.5+ [with Pem Pack](https://raw.githubusercontent.com/muflihun/muflihun.github.io/master/downloads/pem_pack.zip) | ||
* [cmake](https://cmake.org/) v2.8.12+ | ||
* [zlib-devel](https://zlib.net/) | ||
|
||
### Installation | ||
* [Download](https://github.com/muflihun/licensepp/archive/master.zip) or [clone]([email protected]:muflihun/licensepp.git) the repository | ||
* Install Crypto++ | ||
``` | ||
wget https://raw.githubusercontent.com/muflihun/muflihun.github.io/master/downloads/cryptocpp.tar.gz | ||
tar xf cryptocpp.tar.gz | ||
cd cryptopp-CRYPTOPP_5_6_5 | ||
wget https://raw.githubusercontent.com/muflihun/muflihun.github.io/master/downloads/pem_pack.zip | ||
unzip pem_pack.zip | ||
cmake . | ||
make | ||
make install | ||
``` | ||
* Use CMake to build the project | ||
``` | ||
cd <project_root> | ||
mkdir build | ||
cd build | ||
cmake .. | ||
make install | ||
``` | ||
* You can build [cli](/cli) tool or [sample](/sample) code to ensure license++ is installed properly | ||
* You can build [cli](/cli) tool to ensure license++ is installed properly | ||
### Integration | ||
Once you have license++ properly installed please check out [sample](/sample) code for integration | ||
|
@@ -97,6 +117,31 @@ CLI tool provide ability to generate new licenses and validate existing license. | |
./license-manager --validate license.file [--signature <signature>] | ||
``` | ||
## License Format | ||
Licenses generated using License++ are base64 encoded JSON. They look like as follows: | ||
``` | ||
{ | ||
"authority_signature":"632DBBF8BC35A2CAA8CBC2952615839F86A40965A00D6F7420BEFF3DA1D35B9E360B5781D326AD6853991BB31452290FF3415C788255B33D391373A4AA9590E0849C8649FCFC98A6DC827DE2CE61AF15DE21E62E069CE1DB20C72352E6C15A825C0A8140CE42FE7B56C1A53981B3598EEE3AD4EDDD07461269AFC2C8B25B4BDD0C7E6A92986E2F0EAEC5E7C4C673C47AB25B3EE46EF0F3B9C8120865B63E68A505DBC2E85F0646BDF3FD082CA62BB647A0BEFF34E0C7CCE40BD84EABFEA7D902A26D33ADA01F75E7291EC35472B4ED328E0E3AE654E85AAEAEB3FFC9E5A7DE4CB08C9ADAC803367DC2845821E0C310BA26EA26DB3196A65445528AABF45888F6", | ||
"expiry_date":1528386596, | ||
"issue_date":1515426596, | ||
"issuing_authority":"sample-license-authority", | ||
"licensee":"john-citizen", | ||
"licensee_signature":"61663531383163626334303566613461363362343232316632663764393638383A35574F4F4C466B532F7A4F79376446364F6155776C673D3D0D0A0D0A" | ||
} | ||
``` | ||
### Format Explained | ||
| Item | Description | | ||
| ---- | ----------- | | ||
| `authority_signature` | Signature of the authority which prevents alteration in the license | | ||
| `expiry_date` | License expiry date epoch | | ||
| `issue_date` | License issue date epoch | | ||
| `issuing_authority` | ID of issuing authority as per key register | | ||
| `licensee` | Name of the license holder | | ||
| `licensee_signature` | If licensee signed this license this is encrypted against key provided in key register. All the licenses signed by licensee will be validated against it at validation time. | | ||
## License | ||
``` | ||
Copyright (c) 2018-present Muflihun Labs | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
# Locate the Google C++ Testing Framework. | ||
# | ||
# Defines the following variables: | ||
# | ||
# GTEST_FOUND - Found the Google Testing framework | ||
# GTEST_INCLUDE_DIRS - Include directories | ||
# | ||
# Also defines the library variables below as normal | ||
# variables. These contain debug/optimized keywords when | ||
# a debugging library is found. | ||
# | ||
# GTEST_BOTH_LIBRARIES - Both libgtest & libgtest-main | ||
# GTEST_LIBRARIES - libgtest | ||
# GTEST_MAIN_LIBRARIES - libgtest-main | ||
# | ||
# Accepts the following variables as input: | ||
# | ||
# GTEST_ROOT - (as a CMake or environment variable) | ||
# The root directory of the gtest install prefix | ||
# | ||
# GTEST_MSVC_SEARCH - If compiling with MSVC, this variable can be set to | ||
# "MD" or "MT" to enable searching a GTest build tree | ||
# (defaults: "MD") | ||
# | ||
#----------------------- | ||
# Example Usage: | ||
# | ||
# enable_testing() | ||
# find_package(GTest REQUIRED) | ||
# include_directories(${GTEST_INCLUDE_DIRS}) | ||
# | ||
# add_executable(foo foo.cc) | ||
# target_link_libraries(foo ${GTEST_BOTH_LIBRARIES}) | ||
# | ||
# add_test(AllTestsInFoo foo) | ||
# | ||
#----------------------- | ||
# | ||
# If you would like each Google test to show up in CTest as | ||
# a test you may use the following macro. | ||
# NOTE: It will slow down your tests by running an executable | ||
# for each test and test fixture. You will also have to rerun | ||
# CMake after adding or removing tests or test fixtures. | ||
# | ||
# GTEST_ADD_TESTS(executable extra_args ARGN) | ||
# executable = The path to the test executable | ||
# extra_args = Pass a list of extra arguments to be passed to | ||
# executable enclosed in quotes (or "" for none) | ||
# ARGN = A list of source files to search for tests & test | ||
# fixtures. | ||
# | ||
# Example: | ||
# set(FooTestArgs --foo 1 --bar 2) | ||
# add_executable(FooTest FooUnitTest.cc) | ||
# GTEST_ADD_TESTS(FooTest "${FooTestArgs}" FooUnitTest.cc) | ||
|
||
#============================================================================= | ||
# Copyright 2009 Kitware, Inc. | ||
# Copyright 2009 Philip Lowman <[email protected]> | ||
# Copyright 2009 Daniel Blezek <[email protected]> | ||
# | ||
# Distributed under the OSI-approved BSD License (the "License"); | ||
# see accompanying file Copyright.txt for details. | ||
# | ||
# This software is distributed WITHOUT ANY WARRANTY; without even the | ||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
# See the License for more information. | ||
#============================================================================= | ||
# (To distributed this file outside of CMake, substitute the full | ||
# License text for the above reference.) | ||
# | ||
# Thanks to Daniel Blezek <[email protected]> for the GTEST_ADD_TESTS code | ||
|
||
function(GTEST_ADD_TESTS executable extra_args) | ||
if(NOT ARGN) | ||
message(FATAL_ERROR "Missing ARGN: Read the documentation for GTEST_ADD_TESTS") | ||
endif() | ||
foreach(source ${ARGN}) | ||
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}) | ||
add_test(${test_name} ${executable} --gtest_filter=${test_name} ${extra_args}) | ||
list(APPEND _test_names ${test_name}) | ||
endforeach() | ||
endforeach() | ||
set(GTEST_ADD_TEST_NAMES ${_test_names} PARENT_SCOPE) | ||
endfunction() | ||
|
||
function(_gtest_append_debugs _endvar _library) | ||
if(${_library} AND ${_library}_DEBUG) | ||
set(_output optimized ${${_library}} debug ${${_library}_DEBUG}) | ||
else() | ||
set(_output ${${_library}}) | ||
endif() | ||
set(${_endvar} ${_output} PARENT_SCOPE) | ||
endfunction() | ||
|
||
function(_gtest_find_library _name) | ||
find_library(${_name} | ||
NAMES ${ARGN} | ||
HINTS | ||
$ENV{GTEST_ROOT} | ||
${GTEST_ROOT} | ||
PATH_SUFFIXES ${_gtest_libpath_suffixes} | ||
) | ||
mark_as_advanced(${_name}) | ||
endfunction() | ||
|
||
# | ||
|
||
if(NOT DEFINED GTEST_MSVC_SEARCH) | ||
set(GTEST_MSVC_SEARCH MD) | ||
endif() | ||
|
||
set(_gtest_libpath_suffixes lib) | ||
if(MSVC) | ||
if(GTEST_MSVC_SEARCH STREQUAL "MD") | ||
list(APPEND _gtest_libpath_suffixes | ||
msvc/gtest-md/Debug | ||
msvc/gtest-md/Release) | ||
elseif(GTEST_MSVC_SEARCH STREQUAL "MT") | ||
list(APPEND _gtest_libpath_suffixes | ||
msvc/gtest/Debug | ||
msvc/gtest/Release) | ||
endif() | ||
endif() | ||
|
||
|
||
find_path(GTEST_INCLUDE_DIR gtest/gtest.h | ||
HINTS | ||
$ENV{GTEST_ROOT}/include | ||
${GTEST_ROOT}/include | ||
) | ||
mark_as_advanced(GTEST_INCLUDE_DIR) | ||
|
||
if(MSVC AND GTEST_MSVC_SEARCH STREQUAL "MD") | ||
# The provided /MD project files for Google Test add -md suffixes to the | ||
# library names. | ||
_gtest_find_library(GTEST_LIBRARY gtest-md gtest) | ||
_gtest_find_library(GTEST_LIBRARY_DEBUG gtest-mdd gtestd) | ||
_gtest_find_library(GTEST_MAIN_LIBRARY gtest_main-md gtest_main) | ||
_gtest_find_library(GTEST_MAIN_LIBRARY_DEBUG gtest_main-mdd gtest_maind) | ||
else() | ||
_gtest_find_library(GTEST_LIBRARY gtest) | ||
_gtest_find_library(GTEST_LIBRARY_DEBUG gtestd) | ||
_gtest_find_library(GTEST_MAIN_LIBRARY gtest_main) | ||
_gtest_find_library(GTEST_MAIN_LIBRARY_DEBUG gtest_maind) | ||
endif() | ||
|
||
include(FindPackageHandleStandardArgs) | ||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTest DEFAULT_MSG GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY) | ||
|
||
if(GTEST_FOUND) | ||
set(GTEST_INCLUDE_DIRS ${GTEST_INCLUDE_DIR}) | ||
_gtest_append_debugs(GTEST_LIBRARIES GTEST_LIBRARY) | ||
_gtest_append_debugs(GTEST_MAIN_LIBRARIES GTEST_MAIN_LIBRARY) | ||
set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES}) | ||
endif() |
Oops, something went wrong.