Commit | Line | Data |
---|---|---|
970ed795 | 1 | /////////////////////////////////////////////////////////////////////////////// |
3abe9331 | 2 | // Copyright (c) 2000-2015 Ericsson Telecom AB |
970ed795 EL |
3 | // All rights reserved. This program and the accompanying materials |
4 | // are made available under the terms of the Eclipse Public License v1.0 | |
5 | // which accompanies this distribution, and is available at | |
6 | // http://www.eclipse.org/legal/epl-v10.html | |
7 | /////////////////////////////////////////////////////////////////////////////// | |
8 | #include <stdio.h> | |
9 | ||
10 | #include "license.h" | |
11 | ||
12 | int main(int argc, char *argv[]) | |
13 | { | |
14 | license_struct lstr; | |
15 | license_raw lraw; | |
16 | struct tm tm_struct; | |
17 | ||
18 | init_openssl(); | |
19 | ||
20 | if (argc != 2) { | |
21 | fprintf(stderr, "Usage: %s private_key.pem\n", argv[0]); | |
22 | return 1; | |
23 | } | |
24 | ||
25 | lstr.unique_id = 1; | |
26 | lstr.licensee_name = "Janos Zoltan Szabo"; | |
27 | lstr.licensee_email = "Szabo.Janos@eth.ericsson.se"; | |
28 | lstr.licensee_company = "Conformance Lab, " | |
29 | "Ericsson Hungary Ltd."; | |
30 | lstr.licensee_department = "ETH/RL/S"; | |
31 | ||
32 | tm_struct.tm_year = 2001 - 1900; | |
33 | tm_struct.tm_mon = 1 - 1; | |
34 | tm_struct.tm_mday = 1; | |
35 | tm_struct.tm_hour = 0; | |
36 | tm_struct.tm_min = 0; | |
37 | tm_struct.tm_sec = 0; | |
38 | lstr.valid_from = mktime(&tm_struct); | |
39 | ||
40 | tm_struct.tm_year = 2001 - 1900; | |
41 | tm_struct.tm_mon = 12 - 1; | |
42 | tm_struct.tm_mday = 31; | |
43 | tm_struct.tm_hour = 23; | |
44 | tm_struct.tm_min = 59; | |
45 | tm_struct.tm_sec = 59; | |
46 | lstr.valid_until = mktime(&tm_struct); | |
47 | ||
48 | lstr.host_id = 0x80b33fd0; | |
49 | lstr.login_name = "tmpjsz"; | |
50 | lstr.from_major = 1; | |
51 | lstr.from_minor = 1; | |
52 | lstr.from_patchlevel = 0; | |
53 | lstr.to_major = 1; | |
54 | lstr.to_minor = 1; | |
55 | lstr.to_patchlevel = 99; | |
56 | ||
57 | lstr.feature_list = TTCN3_PARSER | | |
58 | TTCN3_COMPILER | | |
59 | TTCN3_TPGEN | | |
60 | TTCN3_SINGLE | | |
61 | TTCN3_MCTR | | |
62 | TTCN3_HC | | |
63 | TTCN3_LOGFORMAT; | |
64 | ||
65 | lstr.limitation_type = LIMIT_HOST | LIMIT_USER; | |
66 | ||
67 | lstr.max_ptcs = 1000; | |
68 | ||
69 | encode_license(&lraw, &lstr); | |
70 | sign_license(&lraw, argv[1]); | |
71 | write_license("license.dat", &lraw); | |
72 | ||
73 | fprintf(stderr, "License file generated.\n"); | |
74 | ||
75 | read_license("license.dat", &lraw); | |
76 | check_license_signature(&lraw); | |
77 | decode_license(&lstr, &lraw); | |
78 | print_license(&lstr); | |
79 | verify_license(&lstr, 1, 1, 8); | |
80 | free_license(&lstr); | |
81 | ||
82 | free_openssl(); | |
83 | ||
84 | return 0; | |
85 | } |