Hazelcast C++ Client
 All Classes Functions Variables Enumerations Enumerator Pages
SSLConfig.h
1 /*
2  * Copyright (c) 2008-2017, Hazelcast, Inc. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #ifndef HAZELCAST_CLIENT_CONFIG_SSLCONFIG_H_
17 #define HAZELCAST_CLIENT_CONFIG_SSLCONFIG_H_
18 
19 #ifdef HZ_BUILD_WITH_SSL
20 
21 #include <string>
22 
23 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
24 #include <WinSock2.h>
25 #endif
26 
27 #include <vector>
28 
29 #include "hazelcast/util/HazelcastDll.h"
30 
31 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
32 #pragma warning(push)
33 #pragma warning(disable: 4251) //for dll export
34 #endif
35 
36 namespace hazelcast {
37  namespace client {
38  namespace config {
39  enum HAZELCAST_API SSLProtocol
40  {
42  sslv2 = 0, // asio::ssl::context_base::sslv2
43 
45  sslv3 = 3, // asio::ssl::context_base::sslv3
46 
48  tlsv1 = 6, // asio::ssl::context_base::tlsv1
49 
51  sslv23 = 9, // asio::ssl::context_base::sslv23
52 
54  tlsv11 = 12, // asio::ssl::context_base::tlsv11,
55 
57  tlsv12 = 15, // asio::ssl::context_base::tlsv12
58  };
59 
63  class HAZELCAST_API SSLConfig {
64  public:
68  SSLConfig();
69 
75  bool isEnabled() const;
76 
82  SSLConfig &setEnabled(bool enabled);
83 
89  SSLConfig &setProtocol(SSLProtocol protocol);
90 
94  SSLProtocol getProtocol() const;
95 
99  const std::vector<std::string> &getVerifyFiles() const;
100 
109  SSLConfig &addVerifyFile(const std::string &filename);
110 
114  const std::string &getCipherList() const;
115 
126  SSLConfig &setCipherList(const std::string &ciphers);
127  private:
128  bool enabled;
129  SSLProtocol sslProtocol;
130  std::vector<std::string> clientVerifyFiles;
131  std::string cipherList;
132  };
133  }
134  }
135 }
136 
137 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
138 #pragma warning(pop)
139 #endif
140 
141 #endif // HZ_BUILD_WITH_SSL
142 
143 #endif /* HAZELCAST_CLIENT_CONFIG_SSLCONFIG_H_ */