-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathLocalKeyGenerator.h
45 lines (34 loc) · 1.05 KB
/
LocalKeyGenerator.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
#pragma once
#include <cstdint>
#include <memory>
#include "ICryptoOperations.h"
#include "LocalFilesystem.h"
#pragma pack(push, 1)
#define SEALEDKEY_MAGIC "pfsSKKey"
#define SEALEDKEY_EXPECTED_TYPE_MAJOR 2
#define SEALEDKEY_EXPECTED_TYPE_MINOR 0
typedef struct sealedkey_t
{
std::uint8_t magic[8];
std::uint8_t type_major;
std::uint8_t type_minor;
std::uint8_t padding[6];
std::uint8_t iv[0x10];
std::uint8_t enc_key[0x10];
std::uint8_t hmac[0x20];
} sealedkey_t;
#define KEYSTONE_MAGIC "keystone"
#define KEYSTONE_EXPECTED_TYPE 2
#define KEYSTONE_EXPECTED_VERSION 1
typedef struct keystone_t
{
std::uint8_t magic[8];
std::uint16_t type;
std::uint16_t version;
std::uint8_t padding[0x14];
std::uint8_t passcode_hmac[0x20];
std::uint8_t keystone_hmac[0x20];
} keystone_t;
#pragma pack(pop)
int get_sealedkey(std::shared_ptr<ICryptoOperations> cryptops, const psvpfs::path& titleIdPath, unsigned char* dec_key);
int get_keystone(std::shared_ptr<ICryptoOperations> cryptops, const psvpfs::path& titleIdPath, char* passcode = 0);