-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtools.hpp
45 lines (38 loc) · 1.19 KB
/
tools.hpp
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
#ifndef TOOLS_HPP
#define TOOLS_HPP
#include <cstring>
#include <sstream>
#include <string>
#include <vector>
#include <sys/types.h>
#include <openssl/bio.h>
#include <openssl/evp.h>
#include "jansson.h"
#include "sqlite3.h"
#if defined(__WIN64__)
#include <windows.h>
#include <Wincrypt.h>
#include <tchar.h>
#elif defined(__linux__)
struct DATA_BLOB
{
unsigned char *pbData;
u_int64_t cbData;
DATA_BLOB()
{
pbData=nullptr;
}
};
#endif
#define COOKIE_PREFIX_LENGTH 3
#define AES_GCM_IV_LENGTH 12
#define AES_GCM_TAG_LENGTH 16
static const std::string b = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
std::string base64_decode(const std::string &in);
std::string cp_datablob_to_string(DATA_BLOB inData);
DATA_BLOB DecryptWithKey(DATA_BLOB *crData, unsigned char *key);
DATA_BLOB DPAPIDecrypt(DATA_BLOB *crData);
std::string EasyDecrypt(DATA_BLOB *crData, unsigned char *key);
DATA_BLOB aes_gcm_encrypt(unsigned char *gcm_key, unsigned char *gcm_iv, unsigned char *gcm_pt);
DATA_BLOB aes_gcm_decrypt(unsigned char *gcm_key, unsigned char *gcm_iv, unsigned char *gcm_ct, unsigned int gcm_ct_len, unsigned char *gcm_tag);
#endif //TOOLS_HPP