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 #include <string>
20 
21 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
22 #include <WinSock2.h>
23 #endif
24 
25 #include <vector>
26 
27 #include "hazelcast/util/HazelcastDll.h"
28 
29 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
30 #pragma warning(push)
31 #pragma warning(disable: 4251) //for dll export
32 #endif
33 
34 namespace hazelcast {
35  namespace client {
36  namespace config {
37  enum HAZELCAST_API SSLProtocol
38  {
40  sslv2 = 0, // asio::ssl::context_base::sslv2
41 
43  sslv3 = 3, // asio::ssl::context_base::sslv3
44 
46  tlsv1 = 6, // asio::ssl::context_base::tlsv1
47 
49  sslv23 = 9, // asio::ssl::context_base::sslv23
50 
52  tlsv11 = 12, // asio::ssl::context_base::tlsv11,
53 
55  tlsv12 = 15, // asio::ssl::context_base::tlsv12
56  };
57 
61  class HAZELCAST_API SSLConfig {
62  public:
66  SSLConfig();
67 
73  bool isEnabled() const;
74 
80  SSLConfig &setEnabled(bool enabled);
81 
87  SSLConfig &setProtocol(SSLProtocol protocol);
88 
92  SSLProtocol getProtocol() const;
93 
97  const std::vector<std::string> &getVerifyFiles() const;
98 
107  SSLConfig &addVerifyFile(const std::string &filename);
108 
112  const std::string &getCipherList() const;
113 
124  SSLConfig &setCipherList(const std::string &ciphers);
125  private:
126  bool enabled;
127  SSLProtocol sslProtocol;
128  std::vector<std::string> clientVerifyFiles;
129  std::string cipherList;
130  };
131  }
132  }
133 }
134 
135 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
136 #pragma warning(pop)
137 #endif
138 
139 #endif /* HAZELCAST_CLIENT_CONFIG_SSLCONFIG_H_ */
Contains configuration parameters for client network related behaviour.
Definition: SSLConfig.h:61