forked from modelica/Encryption-and-Licensing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
103 lines (76 loc) · 4.09 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# Copyright (C) 2015-2022 Modelon AB, 2022-2023 Modelica Association
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the BSD style license.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# BSD_License.txt file for more details.
#
# You should have received a copy of the BSD_License.txt file
# along with this program. If not, contact the Modelica Association <http://www.modelica.org>.
Building instructions
=====================
Prererequisites:
----------------
* For Windows:
* CMake 3.20 or better
* Perl, e.g. from http://strawberryperl.com/
* Nasm, from http://nasm.sourceforge.net/
* Visual Studio (or MinGW)
* Miniz ziplibrary (https://code.google.com/p/miniz/)
* For Linux:
* CMake 3.20 or better
* Perl
* Normal compilation tools, e.g. GCC
* Miniz ziplibrary (https://code.google.com/p/miniz/)
* Before executing test_tool, make sure that the libpath variable in test_tool.c points to
a valid folder.
* After linking you can get a warning saying: "C:/Program Files/Windows Kits/.../mt.exe : Failed to
write to updated manifest to the resource of file test_tool.exe"
If you compile again this warning has usually gone away. I think it has something to do with Visual Studio
but I am not quite sure. It doesn't affect the application though.
* If you get an error saying "Error: SSL: Failed to create client CTX structure." when you run test_tool.exe this means
that the size of the tools private key (in its c-file) is different from the extern statement in source file (mlle_licensing.c).
Building on Windows with Visual Studio:
---------------------------------------
1. Start a MSVC compilation shell for the target platform (32 or 64-bit).
2. Add CMake, Perl and NAMS binary directories to PATH.
3. Create a build directory and cd to it.
4. Execute the commands:
$ cmake <source directory> \
-DCMAKE_INSTALL_PREFIX=<target directory> \
-DDECRYPTOR=<choice of decryptor> \
-DLICENSE_MANAGER=<choice of license manager> \
-DOBFUSCATOR=<choice of obfuscator module> \
-G"NMake Makefiles"
$ cmake --build . --config Release --target install
Note 1: LICENSE_MANAGER, DECRYPTOR, and OBFUSCATOR must be set, default implementations are:
OBFUSCATOR: src/obfuscators/dummy
DECRYPTOR: src/decryptors/default
LICENSE_MANAGER: src/license_managers/testingdummy
Note 2: It is necessary to use the NMake generator due to unknown problems building openssl with other generators.
Note 3: If there are ssl-keys in the openssl_keys directory these will be used. Otherwise new ones will be created.
KEYS_SOURCE_DIRECTORY option can be used to specify alternative directory.
5. To test the tool library type "test_tool.exe".
Note: You must change the part in the test tool that fetch files from LVE.
If you want to fetch an encrypted file, that file must be encrypted with the
latest "encrypt_file.exe" that uses the same random key as LVE to encrypt/decrypt files.
Building on Linux:
------------------
1. Create a build directory and cd to it.
2. Execute the commands:
$ cmake <source directory> \
-DCMAKE_INSTALL_PREFIX=<target directory> \
-DDECRYPTOR=<choice of decryptor> \
-DLICENSE_MANAGER=<choice of license manager> \
-DOBFUSCATOR=<choice of obfuscator module>
$ cmake --build .
$ cmake --build . --target install
Note: If there are ssl-keys in the openssl_keys directory these will be used. Otherwise new ones will be created.
3. To test the tool library type "./test_tool".
Note 1: See Note 1 in "building on Windows"
Note 2: You must change the part in the test tool that fetch files from LVE.
If you want to fetch an encrypted file, that file must be encrypted with the
latest "encrypt_file.exe" that uses the same random key as LVE to encrypt/decrypt files.