comparison C++/modules/Socket/SocketSsl.h @ 373:69532542f7fc

Socket: use TLS by default
author David Demelier <markand@malikania.fr>
date Fri, 01 May 2015 10:15:08 +0200
parents c4381c345f2d
children 92457ea8f7e2
comparison
equal deleted inserted replaced
372:d6e95a577fe9 373:69532542f7fc
36 */ 36 */
37 class SocketSslOptions { 37 class SocketSslOptions {
38 public: 38 public:
39 /** 39 /**
40 * @brief Method 40 * @brief Method
41 *
42 * It is highly recommended to only use TLSv1.
41 */ 43 */
42 enum { 44 enum {
43 SSLv3 = (1 << 0), 45 SSLv3,
44 TLSv1 = (1 << 1), 46 TLSv1
45 All = (0xf)
46 }; 47 };
47 48
48 int method{All}; //!< The method 49 int method{TLSv1}; //!< The method
49 std::string certificate; //!< The certificate path 50 std::string certificate; //!< The certificate path
50 std::string privateKey; //!< The private key file 51 std::string privateKey; //!< The private key file
51 bool verify{false}; //!< Verify or not 52 bool verify{false}; //!< Verify or not
52 53
53 /** 54 /**
61 * @param method the method requested 62 * @param method the method requested
62 * @param certificate the certificate file 63 * @param certificate the certificate file
63 * @param key the key file 64 * @param key the key file
64 * @param verify set to true to verify 65 * @param verify set to true to verify
65 */ 66 */
66 SocketSslOptions(int method, std::string certificate, std::string key, bool verify = false) 67 SocketSslOptions(std::string certificate, std::string key, int method = TLSv1, bool verify = false)
67 : method(method) 68 : method(method)
68 , certificate(std::move(certificate)) 69 , certificate(std::move(certificate))
69 , privateKey(std::move(key)) 70 , privateKey(std::move(key))
70 , verify(verify) 71 , verify(verify)
71 { 72 {