forked from panda3d/panda3d
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenSSLWrapper.h
More file actions
76 lines (59 loc) · 1.76 KB
/
openSSLWrapper.h
File metadata and controls
76 lines (59 loc) · 1.76 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
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file openSSLWrapper.h
* @author drose
* @date 2009-09-05
*/
#ifndef OPENSSLWRAPPER_H
#define OPENSSLWRAPPER_H
#include "pandabase.h"
#ifdef HAVE_OPENSSL
#include "filename.h"
#ifdef _WIN32
#include <winsock2.h> // must be included prior to including OpenSSL.
#endif
#ifndef OPENSSL_NO_KRB5
#define OPENSSL_NO_KRB5
#endif
#include <openssl/ssl.h>
#include <openssl/rand.h>
#include <openssl/err.h>
#include <openssl/x509.h>
#include <openssl/x509v3.h>
// Windows may define this macro inappropriately.
#ifdef X509_NAME
#undef X509_NAME
#endif
/**
* Provides an interface wrapper around the OpenSSL library, to ensure that
* the library is properly initialized in the application, and to provide some
* hooks into global OpenSSL context data.
*/
class EXPCL_PANDA_EXPRESS OpenSSLWrapper {
private:
OpenSSLWrapper();
~OpenSSLWrapper();
PUBLISHED:
void clear_certificates();
int load_certificates(const Filename &filename);
int load_certificates_from_pem_ram(const char *data, size_t data_size);
int load_certificates_from_der_ram(const char *data, size_t data_size);
INLINE int load_certificates_from_pem_ram(const std::string &data);
INLINE int load_certificates_from_der_ram(const std::string &data);
X509_STORE *get_x509_store();
void notify_ssl_errors();
void notify_debug_ssl_errors();
static OpenSSLWrapper *get_global_ptr();
private:
X509_STORE *_x509_store;
static OpenSSLWrapper *_global_ptr;
};
#include "openSSLWrapper.I"
#endif // HAVE_OPENSSL
#endif