Panda3D
Loading...
Searching...
No Matches
openSSLWrapper.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file openSSLWrapper.h
10 * @author drose
11 * @date 2009-09-05
12 */
13
14#ifndef OPENSSLWRAPPER_H
15#define OPENSSLWRAPPER_H
16
17#include "pandabase.h"
18
19#ifdef HAVE_OPENSSL
20#include "filename.h"
21
22#ifdef _WIN32
23#include <winsock2.h> // must be included prior to including OpenSSL.
24#endif
25
26#ifndef OPENSSL_NO_KRB5
27#define OPENSSL_NO_KRB5
28#endif
29
30#include <openssl/ssl.h>
31#include <openssl/rand.h>
32#include <openssl/err.h>
33#include <openssl/x509.h>
34#include <openssl/x509v3.h>
35
36// Windows may define this macro inappropriately.
37#ifdef X509_NAME
38#undef X509_NAME
39#endif
40
41/**
42 * Provides an interface wrapper around the OpenSSL library, to ensure that
43 * the library is properly initialized in the application, and to provide some
44 * hooks into global OpenSSL context data.
45 */
46class EXPCL_PANDA_EXPRESS OpenSSLWrapper {
47private:
48 OpenSSLWrapper();
49 ~OpenSSLWrapper();
50
51PUBLISHED:
52 void clear_certificates();
53 int load_certificates(const Filename &filename);
54 int load_certificates_from_pem_ram(const char *data, size_t data_size);
55 int load_certificates_from_der_ram(const char *data, size_t data_size);
56
57 INLINE int load_certificates_from_pem_ram(const std::string &data);
58 INLINE int load_certificates_from_der_ram(const std::string &data);
59
60 X509_STORE *get_x509_store();
61
62 void notify_ssl_errors();
63 void notify_debug_ssl_errors();
64
65 static OpenSSLWrapper *get_global_ptr();
66
67private:
68 X509_STORE *_x509_store;
69
70 static OpenSSLWrapper *_global_ptr;
71};
72
73#include "openSSLWrapper.I"
74
75#endif // HAVE_OPENSSL
76#endif
The name of a file, such as a texture file or an Egg file.
Definition filename.h:44
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.