forked from Endermanch/XPKeygen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
header.h
163 lines (130 loc) · 3.08 KB
/
header.h
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
//
// Created by Andrew on 09/04/2023.
//
#ifndef KEYGEN_HEADER_H
#define KEYGEN_HEADER_H
#include <cstdio>
#include <cstring>
#include <cassert>
#include <windows.h>
#include <openssl/bn.h>
#include <openssl/ec.h>
#include <openssl/sha.h>
#include <openssl/rand.h>
#define FIELD_BITS 384
#define FIELD_BYTES (FIELD_BITS / 8)
#define FIELD_BITS_2003 512
#define FIELD_BYTES_2003 (FIELD_BITS_2003 / 8)
#define PK_LENGTH 25
#define NULL_TERMINATOR 1
#define IDC_BUTTON1 1000
#define IDC_BUTTON2 1001
#define IDC_BUTTON3 1002
#define IDC_BUTTON4 1003
#define IDC_RADIO1 1005
#define IDC_RADIO2 1006
#define IDC_EDIT1 1010
#define IDC_INPUT1 1020
#define IDC_INPUT2 1021
#define IDC_IMAGE1 1050
#define IDC_IMAGE2 1051
#define IDC_LABEL1 1055
#define IDC_LABEL2 1056
#define IDC_LABEL3 1057
#define IDC_LABEL4 1058
#define IDC_LABEL5 1059
typedef unsigned long ul32;
extern byte charset[];
extern const char pXP[];
extern const long aXP;
extern const long bXP;
// xp.cpp
bool keyXP(
char *pKey,
ul32 nRaw
);
void unpackXP(
ul32 *serial,
ul32 *hash,
ul32 *sig,
ul32 *raw
);
void packXP(
ul32 *raw,
ul32 *serial,
ul32 *hash,
ul32 *sig
);
bool verifyXPKey(
EC_GROUP *eCurve,
EC_POINT *generator,
EC_POINT *publicKey,
char *cdKey
);
void generateXPKey(
char *pKey,
EC_GROUP *eCurve,
EC_POINT *generator,
BIGNUM *order,
BIGNUM *privateKey,
ul32 *pRaw
);
// server.cpp
bool keyServer(
char *pKey
);
void unpackServer(
ul32 *osFamily,
ul32 *hash,
ul32 *sig,
ul32 *prefix,
ul32 *raw
);
void packServer(
ul32 *raw,
ul32 *osFamily,
ul32 *hash,
ul32 *sig,
ul32 *prefix
);
bool verifyServerKey(
EC_GROUP *eCurve,
EC_POINT *generator,
EC_POINT *public_key,
char *cdKey
);
void generateServerKey(
char *pKey,
EC_GROUP *eCurve,
EC_POINT *generator,
BIGNUM *order,
BIGNUM *privateKey,
ul32 *osFamily,
ul32 *prefix
);
// utilities.cpp
void endiannessConvert(byte *data, int length);
ul32 randomRange(ul32 dwLow, ul32 dwHigh);
void stopAudio();
bool playAudio(HINSTANCE hInstance, WCHAR *lpName, UINT bFlags);
EC_GROUP *initializeEllipticCurve(
const char *pSel,
long aSel,
long bSel,
const char *generatorXSel,
const char *generatorYSel,
const char *publicKeyXSel,
const char *publicKeyYSel,
BIGNUM *genOrderSel,
BIGNUM *privateKeySel,
EC_POINT **genPoint,
EC_POINT **pubPoint
);
// key.cpp
void unbase24(ul32 *byteSeq, const char *cdKey);
void base24(char *cdKey, ul32 *byteSeq);
void formatXP(WCHAR *pBSection, WCHAR *pCSection, WCHAR *pText);
void formatServer(WCHAR *pText);
// windows.cpp
bool InitializeWindow(HINSTANCE hInstance);
#endif //KEYGEN_HEADER_H