Commit | Line | Data |
---|---|---|
d44e3c4f | 1 | /****************************************************************************** |
2 | * Copyright (c) 2000-2016 Ericsson Telecom AB | |
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 | * Contributors: | |
9 | * Balasko, Jeno | |
10 | * Szabo, Janos Zoltan – initial implementation | |
11 | * | |
12 | ******************************************************************************/ | |
970ed795 EL |
13 | #include <stdio.h> |
14 | ||
15 | #include "license.h" | |
16 | ||
17 | int main(int argc, char *argv[]) | |
18 | { | |
19 | license_struct lstr; | |
20 | license_raw lraw; | |
21 | struct tm tm_struct; | |
22 | ||
23 | init_openssl(); | |
24 | ||
25 | if (argc != 2) { | |
26 | fprintf(stderr, "Usage: %s private_key.pem\n", argv[0]); | |
27 | return 1; | |
28 | } | |
29 | ||
30 | lstr.unique_id = 1; | |
31 | lstr.licensee_name = "Janos Zoltan Szabo"; | |
32 | lstr.licensee_email = "Szabo.Janos@eth.ericsson.se"; | |
33 | lstr.licensee_company = "Conformance Lab, " | |
34 | "Ericsson Hungary Ltd."; | |
35 | lstr.licensee_department = "ETH/RL/S"; | |
36 | ||
37 | tm_struct.tm_year = 2001 - 1900; | |
38 | tm_struct.tm_mon = 1 - 1; | |
39 | tm_struct.tm_mday = 1; | |
40 | tm_struct.tm_hour = 0; | |
41 | tm_struct.tm_min = 0; | |
42 | tm_struct.tm_sec = 0; | |
43 | lstr.valid_from = mktime(&tm_struct); | |
44 | ||
45 | tm_struct.tm_year = 2001 - 1900; | |
46 | tm_struct.tm_mon = 12 - 1; | |
47 | tm_struct.tm_mday = 31; | |
48 | tm_struct.tm_hour = 23; | |
49 | tm_struct.tm_min = 59; | |
50 | tm_struct.tm_sec = 59; | |
51 | lstr.valid_until = mktime(&tm_struct); | |
52 | ||
53 | lstr.host_id = 0x80b33fd0; | |
54 | lstr.login_name = "tmpjsz"; | |
55 | lstr.from_major = 1; | |
56 | lstr.from_minor = 1; | |
57 | lstr.from_patchlevel = 0; | |
58 | lstr.to_major = 1; | |
59 | lstr.to_minor = 1; | |
60 | lstr.to_patchlevel = 99; | |
61 | ||
62 | lstr.feature_list = TTCN3_PARSER | | |
63 | TTCN3_COMPILER | | |
64 | TTCN3_TPGEN | | |
65 | TTCN3_SINGLE | | |
66 | TTCN3_MCTR | | |
67 | TTCN3_HC | | |
68 | TTCN3_LOGFORMAT; | |
69 | ||
70 | lstr.limitation_type = LIMIT_HOST | LIMIT_USER; | |
71 | ||
72 | lstr.max_ptcs = 1000; | |
73 | ||
74 | encode_license(&lraw, &lstr); | |
75 | sign_license(&lraw, argv[1]); | |
76 | write_license("license.dat", &lraw); | |
77 | ||
78 | fprintf(stderr, "License file generated.\n"); | |
79 | ||
80 | read_license("license.dat", &lraw); | |
81 | check_license_signature(&lraw); | |
82 | decode_license(&lstr, &lraw); | |
83 | print_license(&lstr); | |
84 | verify_license(&lstr, 1, 1, 8); | |
85 | free_license(&lstr); | |
86 | ||
87 | free_openssl(); | |
88 | ||
89 | return 0; | |
90 | } |