-
Notifications
You must be signed in to change notification settings - Fork 16
/
keyset.h
76 lines (62 loc) · 1.03 KB
/
keyset.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
#ifndef _KEYSET_H_
#define _KEYSET_H_
#include "types.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef enum
{
KEY_ERR_LEN_MISMATCH,
KEY_ERR_INVALID_NODE,
KEY_OK
} keystatus;
typedef enum
{
RSAKEY_INVALID,
RSAKEY_PRIV,
RSAKEY_PUB
} rsakeytype;
typedef enum
{
RSASIZE_INVALID,
RSASIZE_4096,
RSASIZE_2048,
} rsakeysize;
typedef struct
{
int index;
unsigned char n[512];
unsigned char e[3];
unsigned char d[512];
unsigned char p[256];
unsigned char q[256];
unsigned char dp[256];
unsigned char dq[256];
unsigned char qp[256];
rsakeytype keytype;
rsakeysize keysize;
} rsakey;
typedef struct
{
int index;
unsigned char data[16];
int valid;
} key128;
typedef struct {
int index;
unsigned char tweak[16];
unsigned char crypt[16];
int valid;
} xtskey128;
typedef struct
{
rsakey nrrrsakey;
} keyset;
void keyset_init(keyset* keys);
int keyset_load(keyset* keys, const char* fname, int verbose);
void keyset_merge(keyset* keys, keyset* src);
void keyset_dump(keyset* keys);
#ifdef __cplusplus
}
#endif
#endif // _KEYSET_H_