-
Notifications
You must be signed in to change notification settings - Fork 1
/
CredentialManager.h
62 lines (49 loc) · 1.24 KB
/
CredentialManager.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
#ifndef _RAIN_CREDENTIALMANAGER_H
#define _RAIN_CREDENTIALMANAGER_H
#include <wx/wx.h>
#include <wx/filename.h>
#include <wx/dir.h>
#include <wx/ffile.h>
#include <openssl/ssl.h>
#undef CERT
//#include <ssl/ssl_locl.h>
#include <openssl/rand.h>
#include <openssl/x509.h>
#include <openssl/x509v3.h>
#include "CryptoHelper.h"
namespace RAIN
{
enum CREDENTIAL_FILE
{
CREDENTIAL_BASE,
CA_PRIVATEKEY,
CA_CERTIFICATE,
CL_PRIVATEKEY,
CL_CERTIFICATE,
CL_CERTREQ,
NETWORK_CRL,
MANIFEST_DIR,
PIECE_DIR,
OUTPUT_DIR,
};
class PeerID;
class CredentialManager
{
public:
CredentialManager(bool initAll);
~CredentialManager();
void Initialise();
static wxString GetPrivateKeyPassword();
static void LockingCallback(int mode, int n, const char *file, int line);
static int OpenSSLPasswordCallback(char *buf, int size, int flag, void *userdata);
static int OpenSSLx509VerificationCallback(int ok, X509_STORE_CTX *store);
static long ShowCertificate(SSL *ssl);
SSL_CTX * GetSSLContext();
PeerID * GetMyPeerID();
static wxString GetCredentialFilename(RAIN::CREDENTIAL_FILE file);
private:
SSL_CTX *ssl_ctx;
PeerID *myid;
};
}
#endif //_RAIN_CREDENTIALMANAGER_H