activemq-cpp-3.8.2
OpenSSLParameters.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef _DECAF_INTERNAL_NET_SSL_OPENSSL_OPENSSLPARAMETERS_H_
19 #define _DECAF_INTERNAL_NET_SSL_OPENSSL_OPENSSLPARAMETERS_H_
20 
21 #include <decaf/util/Config.h>
22 
23 #include <string>
24 #include <vector>
25 
26 #ifdef HAVE_OPENSSL
27 #include <openssl/ssl.h>
28 #endif
29 
30 namespace decaf {
31 namespace internal {
32 namespace net {
33 namespace ssl {
34 namespace openssl {
35 
42  private:
43 
44  bool needClientAuth;
45  bool wantClientAuth;
46  bool useClientMode;
47 
48 #ifdef HAVE_OPENSSL
49  SSL_CTX* context;
50  SSL* ssl;
51 #endif
52 
53  std::vector<std::string> enabledCipherSuites;
54  std::vector<std::string> enabledProtocols;
55  std::vector<std::string> serverNames;
56 
57  private:
58 
60  OpenSSLParameters& operator=(const OpenSSLParameters&);
61 
62  public:
63 
64 #ifdef HAVE_OPENSSL
65  OpenSSLParameters(SSL_CTX* context);
66 #endif
67 
68  virtual ~OpenSSLParameters();
69 
70  bool getNeedClientAuth() const {
71  return this->needClientAuth;
72  }
73 
74  void setNeedClientAuth( bool value ) {
75  this->needClientAuth = value;
76  this->wantClientAuth = false;
77  }
78 
79  bool getWantClientAuth() const {
80  return this->wantClientAuth;
81  }
82 
83  void setWantClientAuth( bool value ) {
84  this->wantClientAuth = value;
85  this->needClientAuth = false;
86  }
87 
88  bool getUseClientMode() const {
89  return this->useClientMode;
90  }
91 
92  void setUseClientMode( bool value ) {
93  this->useClientMode = value;
94  }
95 
96  std::vector<std::string> getSupportedCipherSuites() const;
97 
98  std::vector<std::string> getSupportedProtocols() const;
99 
100  std::vector<std::string> getEnabledCipherSuites() const;
101 
102  void setEnabledCipherSuites(const std::vector<std::string>& suites);
103 
104  std::vector<std::string> getEnabledProtocols() const;
105 
106  void setEnabledProtocols(const std::vector<std::string>& protocols);
107 
108  std::vector<std::string> getServerNames() const;
109 
110  void setServerNames(const std::vector<std::string>& serverNames);
111 
112 #ifdef HAVE_OPENSSL
113 
114  SSL_CTX* getSSLContext() const {
115  return this->context;
116  }
117 
118  SSL* getSSL() const {
119  return this->ssl;
120  }
121 
122 #endif
123 
128  OpenSSLParameters* clone() const;
129 
130  };
131 
132 }}}}}
133 
134 #endif /* _DECAF_INTERNAL_NET_SSL_OPENSSL_OPENSSLPARAMETERS_H_ */
void setNeedClientAuth(bool value)
Definition: OpenSSLParameters.h:74
std::vector< std::string > getEnabledCipherSuites() const
void setEnabledProtocols(const std::vector< std::string > &protocols)
void setServerNames(const std::vector< std::string > &serverNames)
std::vector< std::string > getEnabledProtocols() const
bool getUseClientMode() const
Definition: OpenSSLParameters.h:88
std::vector< std::string > getSupportedProtocols() const
bool getWantClientAuth() const
Definition: OpenSSLParameters.h:79
void setUseClientMode(bool value)
Definition: OpenSSLParameters.h:92
OpenSSLParameters * clone() const
Creates a clone of this object such that all settings are transferred to a new instance of an SSL obj...
std::vector< std::string > getSupportedCipherSuites() const
Container class for parameters that are Common to OpenSSL socket classes.
Definition: OpenSSLParameters.h:41
void setEnabledCipherSuites(const std::vector< std::string > &suites)
std::vector< std::string > getServerNames() const
bool getNeedClientAuth() const
Definition: OpenSSLParameters.h:70
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements...
Definition: AprPool.h:25
void setWantClientAuth(bool value)
Definition: OpenSSLParameters.h:83