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
|
/**
* wii_tik.c
*/
#include "wii_tik.h"
void tik_read(FILE *f, wii_tik *tik) {
fread(tik, sizeof(wii_tik), 1, f);
/* convert to big endian */
tik->sig_type = be32((u8*)&tik->sig_type);
tik->ticket_id = be64((u8*)&tik->ticket_id);
tik->console_id = be32((u8*)&tik->console_id);
tik->title_category = be32((u8*)&tik->title_category);
tik->bought_dlc_contents = be16((u8*)&tik->bought_dlc_contents);
tik->unk7 = be16((u8*)&tik->unk7);
tik->has_time_limit = be32((u8*)&tik->has_time_limit);
tik->time_limit_sec = be32((u8*)&tik->time_limit_sec);
}
void print_tik(wii_tik *tik) {
u32 i;
printf("- ticket\n");
printf("sig_type : %08x (%s)\n", tik->sig_type, (tik->sig_type == RSA_2048 ? "RSA_2048": "RSA_4096"));
printf("signature :\n");
for (i = 0; i < 0x100; i++) {
printf("%02x", tik->signature[i]);
if (((i+1)%8) == 0) printf(" ");
if (((i+1)%16) == 0) printf("\n");
}
printf("issuer : %.64s\n", tik->issuer);
printf("title_key_enc : ");
for (i = 0; i < 0x10; i++) {
printf("%02x", tik->title_key_enc[i]);
}
printf("\n");
printf("unknown : %02x\n", tik->unk2);
printf("ticket_id : %016llx\n", tik->ticket_id);
printf("console_id : %08x\n", tik->console_id);
printf("title_id : %08x-%.4s\n", tik->title_category, (char*)&tik->title_id);
printf("access_mask : %04x\n", tik->access_mask);
printf("bought_dlc_contents: %04x\n", tik->bought_dlc_contents);
printf("unknown : %016llx\n", tik->unk4);
printf("common_key_index : %02x\n", tik->common_key_index);
printf("unknown : %04x\n", tik->unk7);
printf("has_time_limit : %08x\n", tik->has_time_limit);
printf("time_limit_sec : %08x\n", tik->time_limit_sec);
}
|