-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkeys.h
More file actions
113 lines (95 loc) · 2.65 KB
/
keys.h
File metadata and controls
113 lines (95 loc) · 2.65 KB
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
/*
* Copyright (C) 2013, Spaceman Spiff
*
* This file is part of Open SCE Tool.
*
* Open SCE Tool is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Open SCE Tool is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with OpenSCETool. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __KEYS_H_
#define __KEYS_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "types.h"
#include "util.h"
typedef struct _keyset {
char *name;
uint32_t type;
uint32_t revision; // or uint64_t ???
uint64_t version;
uint32_t self_type;
uint32_t erk_len;
uint8_t *erk_key;
uint32_t riv_len;
uint8_t *riv_key;
uint8_t *pub_key;
uint8_t *priv_key;
uint8_t ctype;
} keyset_t;
typedef struct _curve {
uint8_t p[20];
uint8_t a[20];
uint8_t b[20];
uint8_t N[21];
uint8_t Gx[20];
uint8_t Gy[20];
} curve_t;
typedef struct _curve_vsh {
uint8_t p[20];
uint8_t a[20];
uint8_t b[20];
uint8_t N[20];
uint8_t Gx[20];
uint8_t Gy[20];
} curve_vsh_t;
// Keyset from Commandline
typedef struct _keyset_raw {
uint8_t erk[32];
uint8_t riv[16];
uint8_t pub[40];
uint8_t priv[21];
uint8_t curve;
} keyset_raw_t;
typedef struct {
uint8_t unk1[0x10]; //version, license type and user number
uint8_t titleid[0x30]; //Content ID
uint8_t padding[0xC]; //Padding for randomness
uint32_t actdat_index; //Key index on act.dat between 0x00 and 0x7F
uint8_t key[0x10]; //encrypted klicensee
uint64_t unk2; //timestamp??
uint64_t unk3; //Always 0
uint8_t rs[0x28];
} rif_t;
typedef struct {
uint8_t unk1[0x10]; //Version, User number
uint8_t key_table[0x800]; //Key Table
uint8_t unk2[0x800];
uint8_t signature[0x28];
} actdat_t;
extern curve_t *loader_curves;
extern curve_vsh_t *vsh_curves;
void print_keysets(FILE *fp);
int load_keysets(const char *filename);
int load_ldr_curves(const char *filename);
int load_vsh_curves(const char *filename);
//keyset_t *find_keyset_from_header(sce_info_t *sce_info);
keyset_t *find_keyset_by_name(const char *name);
uint8_t *find_key_by_name(const char *name);
int decrypt_klicensee(const uint8_t *title_id, uint8_t *klic);
keyset_t *get_keyset_from_raw(keyset_raw_t *raw);
curve_t *get_vsh_curve(uint32_t type);
#ifdef __cplusplus
}
#endif
#endif