Skip to content

Commit b4c28e9

Browse files
committed
Add new API version v20190401
2 parents a1fc6e7 + 0b78cb3 commit b4c28e9

File tree

80 files changed

+2931
-425
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+2931
-425
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ project (cryptolens)
44
set (CRYPTOLENS_BUILD_TESTS OFF CACHE BOOL "build tests?")
55
set (CRYPTOLENS_CURL_EMBED_CACERTS OFF CACHE BOOL "embed the ca certs in the library instead of using system default files?")
66

7-
set (SRC "src/ActivateError.cpp" "src/DataObject.cpp" "src/LicenseKey.cpp" "src/LicenseKeyChecker.cpp" "src/LicenseKeyInformation.cpp" "src/base64.cpp" "src/basic_SKM.cpp")
7+
set (SRC "src/ActivateError.cpp" "src/DataObject.cpp" "src/LicenseKey.cpp" "src/LicenseKeyChecker.cpp" "src/LicenseKeyInformation.cpp" "src/MachineCodeComputer_static.cpp" "src/basic_Cryptolens.cpp" "src/basic_SKM.cpp" "third_party/base64_OpenBSD/base64.cpp")
88
set (LIBS "")
99

1010
find_package(OpenSSL)

README.md

Lines changed: 52 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
On this page, we have outlined several examples of how to get started with the Cryptolens Client API for C++.
44

5-
> **Note**, Cryptolens Client API for C++ currently supports **activation** and **deactivation** methods. Support for more methods is coming soon.
5+
> **Note**, Cryptolens Client API for C++ currently supports a subset of the full Cryptolens Web API. Please contact us (XXX: Add link) if you need something in particular.
66
77
You can find the API documentation here: [https://help.cryptolens.io/api/cpp/](https://help.cryptolens.io/api/cpp/).
88

@@ -70,6 +70,8 @@ Now we can build the example project:
7070
* Set configuration and platform in the same way as when building the library
7171
* Build and run the project.
7272

73+
Instructions for how to add the library to your own project can be found [here](https://help.cryptolens.io/cpp/). XXX: Fix link
74+
7375
## Library overview
7476

7577
This section contains an overview of the standard way to implement the library in an
@@ -78,33 +80,44 @@ application. The first step is to include the appropriate headers:
7880
```cpp
7981
#include <cryptolens/core.hpp>
8082
#include <cryptolens/Error.hpp>
81-
#include <cryptolens/RequestHandler_XXX.hpp>
82-
#include <cryptolens/SignatureVerifier_YYY.hpp>
83+
#include <cryptolens/Configuration_XXX.hpp>
84+
#include <cryptolens/MachineCodeComputer_YYY.hpp>
85+
86+
namespace cryptolens = ::cryptolens_io::v20190401;
8387
```
8488
85-
We currently support the following RequestHandlers and SignatureVerifiers
89+
Besides including headers the above code sets up a namespace alias for the api version of the C++
90+
library we are using.
91+
92+
The `Configuration` class allows for using different libraries for parsing JSON, making HTTPS
93+
requests, performing cryptographic operations as well as minor changes in the behaviour of the
94+
library. We currently support the following `Configurations` and `MachineCodeComputers`:
8695
87-
| RequestHandler | Description |
88-
| ----------------------------- | ----------------------------------------------------- |
89-
| `RequestHandler_curl` | Uses libcurl |
90-
| `RequestHandler_WinHTTP` | Uses the WinHTTP library available as part of Windows |
96+
| Configuration | Description |
97+
| ----------------------------------- | ----------------------------------------------------- |
98+
| `Configuration_Unix` | Good default configuration for Unix-like based systems. Uses ArduinoJson 5, libcurl and OpenSSL. Checks if the license key has expired against the users system time. |
99+
| `Configuration_Unix_IgnoreExpires` | Same as `Configuration_Unix`, but does not check if the license key has expired against the users system time. |
100+
| `Configuration_Windows` | Good default configuration for Windows based systems. Uses ArduinoJson 5, WinHTTP and CryptoAPI. Checks if the license key has expired against the users system time. |
101+
| `Configuration_Windows_IgnoreExpires` | Same as `Configuration_Windows`, but does not check if the license key has expired against the users system time. |
91102
92-
| SignatureVerifier | Description |
93-
| ----------------------------- | ----------------------------------------------- |
94-
| `SignatureVerifier_OpenSSL` | Uses OpenSSL or LibreSSL |
95-
| `SignatureVerifier_CryptoAPI` | Uses the CryptoAPI available as part of Windows |
103+
| MachineCodeComputer | Description |
104+
| ------------------------------- | ----------------------------------------------- |
105+
| `MachineCodeComputer_static` | Does not automatically compute a machine code, instead the machine code is set by calling a function |
96106
97107
The next step is to create and set up a handle class responsible for making requests
98108
to the Cryptolens Web API.
99109
100110
```cpp
101111
using Cryptolens = cryptolens::basic_Cryptolens
102-
<cryptolens::RequestHandler_curl, cryptolens::SignatureVerifier_OpenSSL>;
112+
<cryptolens::Configuration_XXX<cryptolens::MachineCodeComputer_static>>;
103113
104-
Cryptolens cryptolens_handle;
105114
cryptolens::Error e;
115+
Cryptolens cryptolens_handle(e);
116+
106117
cryptolens_handle.signature_verifier.set_modulus_base64(e, "ABCDEFGHI1234");
107118
cryptolens_handle.signature_verifier.set_exponent_base64(e, "ABCD");
119+
120+
cryptolens_handle.machine_code_computer.set_machine_code(e, "289jf2afs3");
108121
```
109122

110123
Here the strings `"ABCDEFGHI1234"` and `"ABCD"` needs to be replaced by your public keys. These
@@ -116,6 +129,8 @@ the following value on the website
116129
<RSAKeyValue><Modulus>ABCDEFGHI1234</Modulus><Exponent>ABCD</Exponent></RSAKeyValue>
117130
```
118131
132+
In this example we set the machine code used to `"289jf2afs3"`.
133+
119134
Now that the handle class has been set up, we can attempt to activate a license key
120135
121136
```cpp
@@ -126,11 +141,9 @@ cryptolens::optional<cryptolens::LicenseKey> license_key =
126141
, // Cryptolens Access Token
127142
"WyI0NjUiLCJBWTBGTlQwZm9WV0FyVnZzMEV1Mm9LOHJmRDZ1SjF0Vk52WTU0VzB2Il0="
128143
, // Product id
129-
"3646"
144+
3646
130145
, // License Key
131146
"MPDWY-PQAOW-FKSCH-SGAAU"
132-
, // Machine Code
133-
"289jf2afs3"
134147
);
135148
136149
if (e) {
@@ -150,8 +163,6 @@ The `activate` method takes several arguments:
150163
https://app.cryptolens.io/Product.
151164
1. The fourth argument is a string containing the license key string, in most cases this will be
152165
input by the user of the application in some application dependent fashion.
153-
1. The last argument is an optional identifier for the device the application is running on, or
154-
something similar.
155166

156167
After the `activate` call we check if an error occurred by converting `e` to bool. If an error
157168
occured this returns true. If an error occurs, the optional containing the `LicenseKey` object
@@ -167,8 +178,8 @@ if (license_key->check()->has_expired(1234567)) {
167178
return 1;
168179
}
169180

170-
if (license_key->check()-has_feature(1)) { std::cout << "Welcome! Pro version enabled!" << std::endl; }
171-
else { std::cout << "Welcome!" << std::endl; }
181+
if (license_key->check()->has_feature(1)) { std::cout << "Welcome! Pro version enabled!" << std::endl; }
182+
else { std::cout << "Welcome!" << std::endl; }
172183
```
173184
174185
@@ -202,22 +213,24 @@ request to the Web API in the future. Thus we can proceed as during online activ
202213
but save the response as a string:
203214

204215
```cpp
205-
Cryptolens cryptolens_handle;
216+
cryptolens::Error e;
217+
Cryptolens cryptolens_handle(e);
218+
206219
cryptolens_handle.signature_verifier.set_modulus_base64(e, "ABCDEFGHI1234");
207220
cryptolens_handle.signature_verifier.set_exponent_base64(e, "ABCD");
208-
...
221+
222+
cryptolens_handle.machine_code_computer.set_machine_code(e, "289jf2afs3");
223+
209224
cryptolens::optional<cryptolens::LicenseKey> license_key =
210-
cryptolens_handle.activate(
225+
cryptolens_handle.activate
211226
( // Object used for reporting if an error occured
212227
e
213228
, // Cryptolens Access Token
214229
"WyI0NjUiLCJBWTBGTlQwZm9WV0FyVnZzMEV1Mm9LOHJmRDZ1SjF0Vk52WTU0VzB2Il0="
215230
, // Product id
216-
"3646"
231+
3646
217232
, // License Key
218233
"MPDWY-PQAOW-FKSCH-SGAAU"
219-
, // Machine Code
220-
"289jf2afs3"
221234
);
222235
if (e) { handle_error(e); return 1; }
223236

@@ -229,10 +242,13 @@ to check the license later when offline, load the string *s* and recover the lic
229242
230243
```cpp
231244
cryptolens::Error e;
232-
Cryptolens cryptolens_handle;
245+
Cryptolens cryptolens_handle(e);
246+
233247
cryptolens_handle.signature_verifier.set_modulus_base64(e, "ABCDEFGHI1234");
234248
cryptolens_handle.signature_verifier.set_exponent_base64(e, "ABCD");
235249
250+
cryptolens_handle.machine_code_computer.set_machine_code(e, "289jf2afs3");
251+
236252
cryptolens::optional<cryptolens::LicenseKey> license_key =
237253
cryptolens_handle.make_license_key(e, s);
238254
if (e) { handle_error(e); return 1; }
@@ -251,13 +267,16 @@ by using the `handle_activate()` function as follows
251267
```cpp
252268
std::string web_api_response; // Some other part of the code creates and populates this object
253269

254-
SignatureVerifier_XXX signature_verifier;
255270
cryptolens::Error e;
256-
signature_verifier.set_modulus_base64(e, "ABCDEFGHI1234");
257-
signature_verifier.set_exponent_base64(e, "ABCD");
271+
Cryptolens cryptolens_handle(e);
258272

259-
cryptolens::optional<cryptolens::LicenseKey> key =
260-
cryptolens::handle_activate(e, signature_verifier, web_api_resonse);
273+
cryptolens_handle.signature_verifier.set_modulus_base64(e, "ABCDEFGHI1234");
274+
cryptolens_handle.signature_verifier.set_exponent_base64(e, "ABCD");
275+
276+
cryptolens_handle.machine_code_computer.set_machine_code(e, "289jf2afs3");
277+
278+
cryptolens::optional<cryptolens::LicenseKey> license_key =
279+
cryptolens_handle.make_license_key(e, web_api_response);
261280
if (e) { handle_error(e); return 1; }
262281
```
263282

examples/VisualStudio/Example_Activate/Example_Activate.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
11
#include <iostream>
22

3-
#include "cryptolens\core.hpp"
4-
#include "cryptolens\Error.hpp"
5-
#include "cryptolens\RequestHandler_WinHTTP.hpp"
6-
#include "cryptolens\SignatureVerifier_CryptoAPI.hpp"
3+
#include <cryptolens/core.hpp>
4+
#include <cryptolens/Error.hpp>
5+
#include <cryptolens/Configuration_Windows.hpp>
6+
#include <cryptolens/MachineCodeComputer_static.hpp>
77

8-
namespace cryptolens = ::cryptolens_io::v20180502;
9-
using Cryptolens = cryptolens::basic_SKM<cryptolens::RequestHandler_WinHTTP, cryptolens::SignatureVerifier_CryptoAPI>;
8+
namespace cryptolens = ::cryptolens_io::v20190401;
9+
using Cryptolens = cryptolens::basic_Cryptolens<cryptolens::Configuration_Windows<cryptolens::MachineCodeComputer_static>>;
1010

1111
/*
1212
* This example uses the basic_SKM class to make a request to the WebAPI
1313
* and then checks some properties of the license keys.
1414
*/
15-
1615
int main()
1716
{
18-
Cryptolens cryptolens_handle;
1917
cryptolens::Error e;
18+
Cryptolens cryptolens_handle(e);
19+
2020
// Setting up the signature verifier with credentials from "Security Settings"
2121
// on serialkeymanager.com
2222
cryptolens_handle.signature_verifier.set_modulus_base64(e, "khbyu3/vAEBHi339fTuo2nUaQgSTBj0jvpt5xnLTTF35FLkGI+5Z3wiKfnvQiCLf+5s4r8JB/Uic/i6/iNjPMILlFeE0N6XZ+2pkgwRkfMOcx6eoewypTPUoPpzuAINJxJRpHym3V6ZJZ1UfYvzRcQBD/lBeAYrvhpCwukQMkGushKsOS6U+d+2C9ZNeP+U+uwuv/xu8YBCBAgGb8YdNojcGzM4SbCtwvJ0fuOfmCWZvUoiumfE4x7rAhp1pa9OEbUe0a5HL+1v7+JLBgkNZ7Z2biiHaM6za7GjHCXU8rojatEQER+MpgDuQV3ZPx8RKRdiJgPnz9ApBHFYDHLDzDw==");
2323
cryptolens_handle.signature_verifier.set_exponent_base64(e, "AQAB");
2424

25+
cryptolens_handle.machine_code_computer.set_machine_code(e, "289jf2afs3");
26+
2527
cryptolens::optional<cryptolens::LicenseKey> license_key =
2628
cryptolens_handle.activate(
2729
e,
2830
// SKM Access Token
2931
"WyI0NjUiLCJBWTBGTlQwZm9WV0FyVnZzMEV1Mm9LOHJmRDZ1SjF0Vk52WTU0VzB2Il0=",
3032
// Product id
31-
"3646",
33+
3646,
3234
// License Key
33-
"MPDWY-PQAOW-FKSCH-SGAAU",
34-
// Machine Code
35-
"289jf2afs3"
35+
"MPDWY-PQAOW-FKSCH-SGAAU"
3636
);
3737

3838
if (e) {

examples/VisualStudio/Example_External/Example_External.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,29 @@
22

33
#include <cryptolens/core.hpp>
44
#include <cryptolens/Error.hpp>
5-
#include "cryptolens/RequestHandler_WinHTTP.hpp"
6-
#include <cryptolens/SignatureVerifier_CryptoAPI.hpp>
5+
#include <cryptolens/Configuration_Windows.hpp>
6+
#include <cryptolens/MachineCodeComputer_static.hpp>
7+
8+
namespace cryptolens = ::cryptolens_io::v20190401;
9+
using Cryptolens = cryptolens::basic_Cryptolens<cryptolens::Configuration_Windows<cryptolens::MachineCodeComputer_static>>;
710

811
/*
912
* This example assumes the reply from the web server has fetched in some
1013
* other fasion, and then verifies the signature and finally checks
1114
* some properties on the license key.
1215
*/
13-
14-
namespace cryptolens = ::cryptolens_io::v20180502;
15-
using Cryptolens = cryptolens::basic_SKM<cryptolens::RequestHandler_WinHTTP, cryptolens::SignatureVerifier_CryptoAPI>;
16-
1716
int main()
1817
{
19-
Cryptolens cryptolens_handle;
2018
cryptolens::Error e;
19+
Cryptolens cryptolens_handle(e);
20+
2121
// Setting up the signature verifier with credentials from "Security Settings"
2222
// on cryptolens.io
2323
cryptolens_handle.signature_verifier.set_modulus_base64(e, "khbyu3/vAEBHi339fTuo2nUaQgSTBj0jvpt5xnLTTF35FLkGI+5Z3wiKfnvQiCLf+5s4r8JB/Uic/i6/iNjPMILlFeE0N6XZ+2pkgwRkfMOcx6eoewypTPUoPpzuAINJxJRpHym3V6ZJZ1UfYvzRcQBD/lBeAYrvhpCwukQMkGushKsOS6U+d+2C9ZNeP+U+uwuv/xu8YBCBAgGb8YdNojcGzM4SbCtwvJ0fuOfmCWZvUoiumfE4x7rAhp1pa9OEbUe0a5HL+1v7+JLBgkNZ7Z2biiHaM6za7GjHCXU8rojatEQER+MpgDuQV3ZPx8RKRdiJgPnz9ApBHFYDHLDzDw==");
2424
cryptolens_handle.signature_verifier.set_exponent_base64(e, "AQAB");
2525

26+
cryptolens_handle.machine_code_computer.set_machine_code(e, "289jf2afs3");
27+
2628
// Reply from Cryptolens Web API
2729
std::string cryptolens_reply("{\"licenseKey\":\"eyJQcm9kdWN0SWQiOjM2NDYsIklEIjo0LCJLZXkiOiJNUERXWS1QUUFPVy1GS1NDSC1TR0FBVSIsIkNyZWF0ZWQiOjE0OTAzMTM2MDAsIkV4cGlyZXMiOjE0OTI5MDU2MDAsIlBlcmlvZCI6MzAsIkYxIjpmYWxzZSwiRjIiOmZhbHNlLCJGMyI6ZmFsc2UsIkY0IjpmYWxzZSwiRjUiOmZhbHNlLCJGNiI6ZmFsc2UsIkY3IjpmYWxzZSwiRjgiOmZhbHNlLCJOb3RlcyI6bnVsbCwiQmxvY2siOmZhbHNlLCJHbG9iYWxJZCI6MzE4NzYsIkN1c3RvbWVyIjpudWxsLCJBY3RpdmF0ZWRNYWNoaW5lcyI6W3siTWlkIjoiIiwiSVAiOiIxNTUuNC4xMzQuMjciLCJUaW1lIjoxNDkxODk4OTE4fSx7Ik1pZCI6ImxvbCIsIklQIjoiMTU1LjQuMTM0LjI3IiwiVGltZSI6MTQ5MTg5ODk5NX0seyJNaWQiOiIyODlqZjJhZnNmIiwiSVAiOiIxNTUuNC4xMzQuMjciLCJUaW1lIjoxNDkxOTAwNTQ2fSx7Ik1pZCI6IjI4OWpmMmFmczMiLCJJUCI6IjE1NS40LjEzNC4yNyIsIlRpbWUiOjE0OTE5MDA2MzZ9XSwiVHJpYWxBY3RpdmF0aW9uIjpmYWxzZSwiTWF4Tm9PZk1hY2hpbmVzIjoxMCwiQWxsb3dlZE1hY2hpbmVzIjoiIiwiRGF0YU9iamVjdHMiOltdLCJTaWduRGF0ZSI6MTQ5NTAxOTc2Nn0=\",\"signature\":\"SqPm8dtTdVBrXrmJzXer7qq6dvdQfctJxP8mar+RO9p8QABsgWWaX+uH7aOGMBd42eg+2Omorv7Ks6V7itRhXPeeq5qWoKuefd+pTsFagvqiu2N/E2Np8fpt51aqmiygdHLECo42nJwVD8JzlN67hnvJTgY7iyDWhG7qFK9Slk+kEJjjK/0J1pJYI6nOi+7sgBV7ZRca+7DmiP6OmOjNfySps6PdiB7QbiSis5f24Xmc5OYyRe3fzZmAueqF3eymBK19XhYFroWXeT4tcNsBNJsv+YfItovGbJysLx+K4ppltd2GNwEFQgtE3ILGOUj7EVbeQmQXg9m2c5MTPyk8iA==\",\"result\":0,\"message\":\"\"}");
2830

examples/VisualStudio/Example_Floating/Example_Floating.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,27 @@
22

33
#include <cryptolens/core.hpp>
44
#include <cryptolens/Error.hpp>
5-
#include <cryptolens/RequestHandler_WinHTTP.hpp>
6-
#include <cryptolens/SignatureVerifier_CryptoAPI.hpp>
5+
#include <cryptolens/Configuration_Windows.hpp>
6+
#include <cryptolens/MachineCodeComputer_static.hpp>
77

8-
namespace cryptolens = ::cryptolens_io::v20180502;
9-
using Cryptolens = cryptolens::basic_SKM<cryptolens::RequestHandler_WinHTTP, cryptolens::SignatureVerifier_CryptoAPI>;
8+
namespace cryptolens = ::cryptolens_io::v20190401;
9+
using Cryptolens = cryptolens::basic_Cryptolens<cryptolens::Configuration_Windows<cryptolens::MachineCodeComputer_static>>;
1010

1111
/*
1212
* This example uses the basic_SKM class to make a request to the WebAPI
1313
* and then checks some properties of the license keys.
1414
*/
15-
1615
void activate(char const* machine_code)
1716
{
18-
Cryptolens cryptolens_handle;
1917
cryptolens::Error e;
18+
Cryptolens cryptolens_handle(e);
19+
2020
// Setting up the signature verifier with credentials from "Security Settings"
2121
// on cryptolens.io
2222
cryptolens_handle.signature_verifier.set_modulus_base64(e, "khbyu3/vAEBHi339fTuo2nUaQgSTBj0jvpt5xnLTTF35FLkGI+5Z3wiKfnvQiCLf+5s4r8JB/Uic/i6/iNjPMILlFeE0N6XZ+2pkgwRkfMOcx6eoewypTPUoPpzuAINJxJRpHym3V6ZJZ1UfYvzRcQBD/lBeAYrvhpCwukQMkGushKsOS6U+d+2C9ZNeP+U+uwuv/xu8YBCBAgGb8YdNojcGzM4SbCtwvJ0fuOfmCWZvUoiumfE4x7rAhp1pa9OEbUe0a5HL+1v7+JLBgkNZ7Z2biiHaM6za7GjHCXU8rojatEQER+MpgDuQV3ZPx8RKRdiJgPnz9ApBHFYDHLDzDw==");
23-
//cryptolens_handle.signature_verifier.set_exponent_base64(e, "AQAB");
23+
cryptolens_handle.signature_verifier.set_exponent_base64(e, "AQAB");
24+
25+
cryptolens_handle.machine_code_computer.set_machine_code(e, machine_code);
2426

2527
cryptolens::optional<cryptolens::LicenseKey> license_key =
2628
cryptolens_handle.activate_floating
@@ -29,11 +31,9 @@ void activate(char const* machine_code)
2931
, // Cryptolens Access Token
3032
"WyIxNDQzIiwiZXBCVGc1S2tOVmRielVibXAxaWdtdVNtOXlGTnR0ekhkN2lwRnVKQiJd"
3133
, // Product id
32-
"3934"
34+
3934
3335
, // License Key
3436
"KRQNS-CSPNV-XRQBT-MTSBI"
35-
, // Machine Code
36-
machine_code
3737
, // Floating interval
3838
10
3939
);

examples/VisualStudio/Example_Offline/Example_Offline.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55

66
#include <cryptolens/core.hpp>
77
#include <cryptolens/Error.hpp>
8-
#include <cryptolens/RequestHandler_WinHTTP.hpp>
9-
#include <cryptolens/SignatureVerifier_CryptoAPI.hpp>
8+
#include <cryptolens/Configuration_Windows.hpp>
9+
#include <cryptolens/MachineCodeComputer_static.hpp>
1010

11-
namespace cryptolens = ::cryptolens_io::v20180502;
12-
using Cryptolens = cryptolens::basic_SKM<cryptolens::RequestHandler_WinHTTP, cryptolens::SignatureVerifier_CryptoAPI>;
11+
namespace cryptolens = ::cryptolens_io::v20190401;
12+
using Cryptolens = cryptolens::basic_Cryptolens<cryptolens::Configuration_Windows<cryptolens::MachineCodeComputer_static>>;
1313

1414
/*
1515
* This is an example of doing offline activation.
@@ -50,25 +50,26 @@ int write_license_key_to_file(LPCWSTR file_name)
5050
/*
5151
* Standard code for performing online activation
5252
*/
53-
Cryptolens cryptolens_handle;
5453
cryptolens::Error e;
54+
Cryptolens cryptolens_handle(e);
55+
5556
// Setting up the signature verifier with credentials from "Security Settings"
5657
// on cryptolens.io
5758
cryptolens_handle.signature_verifier.set_modulus_base64(e, "khbyu3/vAEBHi339fTuo2nUaQgSTBj0jvpt5xnLTTF35FLkGI+5Z3wiKfnvQiCLf+5s4r8JB/Uic/i6/iNjPMILlFeE0N6XZ+2pkgwRkfMOcx6eoewypTPUoPpzuAINJxJRpHym3V6ZJZ1UfYvzRcQBD/lBeAYrvhpCwukQMkGushKsOS6U+d+2C9ZNeP+U+uwuv/xu8YBCBAgGb8YdNojcGzM4SbCtwvJ0fuOfmCWZvUoiumfE4x7rAhp1pa9OEbUe0a5HL+1v7+JLBgkNZ7Z2biiHaM6za7GjHCXU8rojatEQER+MpgDuQV3ZPx8RKRdiJgPnz9ApBHFYDHLDzDw==");
5859
cryptolens_handle.signature_verifier.set_exponent_base64(e, "AQAB");
5960

61+
cryptolens_handle.machine_code_computer.set_machine_code(e, "289jf2afs3");
62+
6063
cryptolens::optional<cryptolens::LicenseKey> license_key =
6164
cryptolens_handle.activate
6265
( // Object used for reporting if an error occured
6366
e
6467
, // Cryptolens Access Token
6568
"WyI0NjUiLCJBWTBGTlQwZm9WV0FyVnZzMEV1Mm9LOHJmRDZ1SjF0Vk52WTU0VzB2Il0="
6669
, // Product id
67-
"3646"
70+
3646
6871
, // License Key
6972
"MPDWY-PQAOW-FKSCH-SGAAU"
70-
, // Machine Code
71-
"289jf2afs3"
7273
);
7374

7475
if (e) {
@@ -104,8 +105,9 @@ int read_license_key_from_file(LPCWSTR file_name) {
104105
/*
105106
* We need to set up the cryptolens_handle with the public keys as usual.
106107
*/
107-
Cryptolens cryptolens_handle;
108108
cryptolens::Error e;
109+
Cryptolens cryptolens_handle(e);
110+
109111
// Setting up the signature verifier with credentials from "Security Settings"
110112
// on cryptolens.io
111113
cryptolens_handle.signature_verifier.set_modulus_base64(e, "khbyu3/vAEBHi339fTuo2nUaQgSTBj0jvpt5xnLTTF35FLkGI+5Z3wiKfnvQiCLf+5s4r8JB/Uic/i6/iNjPMILlFeE0N6XZ+2pkgwRkfMOcx6eoewypTPUoPpzuAINJxJRpHym3V6ZJZ1UfYvzRcQBD/lBeAYrvhpCwukQMkGushKsOS6U+d+2C9ZNeP+U+uwuv/xu8YBCBAgGb8YdNojcGzM4SbCtwvJ0fuOfmCWZvUoiumfE4x7rAhp1pa9OEbUe0a5HL+1v7+JLBgkNZ7Z2biiHaM6za7GjHCXU8rojatEQER+MpgDuQV3ZPx8RKRdiJgPnz9ApBHFYDHLDzDw==");

0 commit comments

Comments
 (0)