GENERIC_SERVER  0.0.0.9
A light-weight, cross-platform, pluggable, extensible and secure framework for deploying C++ plug-ins.
 All Classes Files Functions Variables Typedefs Pages
sslserver.h
Go to the documentation of this file.
1 /*
2  Copyright 2013 Broadcom Corporation
3 
4  This program is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Lesser General Public
6  License version 2.1 as published by the Free Software Foundation.
7 
8  This library is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  Lesser General Public License for more details.
12 
13  You should have received a copy of the GNU Lesser General Public
14  License along with this library; if not, write to the Free Software
15  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17 
30 #ifndef WINDOWS
31 #include <pthread.h>
32 #
33 #include <sys/socket.h>
34 #include <arpa/inet.h>
35 #include <resolv.h>
36 #include <unistd.h>
37 #endif
38 #include <openssl/ssl.h>
39 #include <openssl/err.h>
40 #include <openssl/rand.h>
41 #include <stdio.h>
42 #include <string.h>
43 #include <iostream>
44 
45 #ifndef __SSL_SERVER_H__
46 #define __SSL_SERVER_H__
47 
48 using namespace std;
50 class SSLServer
51 {
52  // Private data
53  private:
54  SSL_CTX *ctx;
55  string cert_file;
56  string priv_key_file;
57  string ca_certificate;
58  bool verify_client;
59 
60  public:
62  SSLServer();
63  SSLServer(char *cFile, char *kFile);
64  int set_priv_key(string priv_key);
65  int set_ca_cert(string ca_cert);
66  int set_cert_file(string server_cert_file);
67  int set_verify_client(bool status_flag);
69  int CreateCTX(void);
71  int LoadCerts(void);
72  SSL_CTX *get_ctx(void);
76  int tls_init(void);
77  int tls_cleanup(void);
78 };
79 
80 #endif
Utility class for TLS. Please refer excellent documentation at: http://www.openssl.org/docs/ssl/ssl.html.
Definition: sslserver.h:50