|
ferencd@0
|
1 //
|
|
ferencd@0
|
2 // VMime library (http://www.vmime.org)
|
|
ferencd@0
|
3 // Copyright (C) 2002-2013 Vincent Richard <vincent@vmime.org>
|
|
ferencd@0
|
4 //
|
|
ferencd@0
|
5 // This program is free software; you can redistribute it and/or
|
|
ferencd@0
|
6 // modify it under the terms of the GNU General Public License as
|
|
ferencd@0
|
7 // published by the Free Software Foundation; either version 3 of
|
|
ferencd@0
|
8 // the License, or (at your option) any later version.
|
|
ferencd@0
|
9 //
|
|
ferencd@0
|
10 // This program is distributed in the hope that it will be useful,
|
|
ferencd@0
|
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
ferencd@0
|
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
ferencd@0
|
13 // General Public License for more details.
|
|
ferencd@0
|
14 //
|
|
ferencd@0
|
15 // You should have received a copy of the GNU General Public License along
|
|
ferencd@0
|
16 // with this program; if not, write to the Free Software Foundation, Inc.,
|
|
ferencd@0
|
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
ferencd@0
|
18 //
|
|
ferencd@0
|
19 // Linking this library statically or dynamically with other modules is making
|
|
ferencd@0
|
20 // a combined work based on this library. Thus, the terms and conditions of
|
|
ferencd@0
|
21 // the GNU General Public License cover the whole combination.
|
|
ferencd@0
|
22 //
|
|
ferencd@0
|
23
|
|
ferencd@0
|
24 #ifndef VMIME_NET_TLS_TLSPROPERTIES_HPP_INCLUDED
|
|
ferencd@0
|
25 #define VMIME_NET_TLS_TLSPROPERTIES_HPP_INCLUDED
|
|
ferencd@0
|
26
|
|
ferencd@0
|
27
|
|
ferencd@0
|
28 #include "vmime/config.hpp"
|
|
ferencd@0
|
29
|
|
ferencd@0
|
30
|
|
ferencd@0
|
31 #if VMIME_HAVE_MESSAGING_FEATURES && VMIME_HAVE_TLS_SUPPORT
|
|
ferencd@0
|
32
|
|
ferencd@0
|
33
|
|
ferencd@0
|
34 #include "vmime/types.hpp"
|
|
ferencd@0
|
35
|
|
ferencd@0
|
36
|
|
ferencd@0
|
37 namespace vmime {
|
|
ferencd@0
|
38 namespace net {
|
|
ferencd@0
|
39 namespace tls {
|
|
ferencd@0
|
40
|
|
ferencd@0
|
41
|
|
ferencd@0
|
42 /** Holds options for a TLS session.
|
|
ferencd@0
|
43 */
|
|
ferencd@0
|
44 class VMIME_EXPORT TLSProperties : public object
|
|
ferencd@0
|
45 {
|
|
ferencd@0
|
46 public:
|
|
ferencd@0
|
47
|
|
ferencd@0
|
48 TLSProperties();
|
|
ferencd@0
|
49 TLSProperties(const TLSProperties&);
|
|
ferencd@0
|
50
|
|
ferencd@0
|
51
|
|
ferencd@0
|
52 /** Predefined generic cipher suites (work with all TLS libraries). */
|
|
ferencd@0
|
53 enum GenericCipherSuite
|
|
ferencd@0
|
54 {
|
|
ferencd@0
|
55 CIPHERSUITE_HIGH, /**< High encryption cipher suites (> 128 bits). */
|
|
ferencd@0
|
56 CIPHERSUITE_MEDIUM, /**< Medium encryption cipher suites (>= 128 bits). */
|
|
ferencd@0
|
57 CIPHERSUITE_LOW, /**< Low encryption cipher suites (>= 64 bits). */
|
|
ferencd@0
|
58
|
|
ferencd@0
|
59 CIPHERSUITE_DEFAULT /**< Default cipher suite. */
|
|
ferencd@0
|
60 };
|
|
ferencd@0
|
61
|
|
ferencd@0
|
62 /** Sets the cipher suite preferences for a SSL/TLS session, using
|
|
ferencd@0
|
63 * predefined, generic suites. This works with all underlying TLS
|
|
ferencd@0
|
64 * libraries (OpenSSL and GNU TLS).
|
|
ferencd@0
|
65 *
|
|
ferencd@0
|
66 * @param cipherSuite predefined cipher suite
|
|
ferencd@0
|
67 */
|
|
ferencd@0
|
68 void setCipherSuite(const GenericCipherSuite cipherSuite);
|
|
ferencd@0
|
69
|
|
ferencd@0
|
70 /** Sets the cipher suite preferences for a SSL/TLS session, using
|
|
ferencd@0
|
71 * a character string. The format and meaning of the string depend
|
|
ferencd@0
|
72 * on the underlying TLS library.
|
|
ferencd@0
|
73 *
|
|
ferencd@0
|
74 * For GNU TLS, read this:
|
|
ferencd@0
|
75 * http://gnutls.org/manual/html_node/Priority-ddm_strings.html
|
|
ferencd@0
|
76 *
|
|
ferencd@0
|
77 * For OpenSSL, read this:
|
|
ferencd@0
|
78 * http://www.openssl.org/docs/apps/ciphers.html#CIPHER_STRINGS
|
|
ferencd@0
|
79 *
|
|
ferencd@0
|
80 * @param cipherSuite cipher suite as a string
|
|
ferencd@0
|
81 */
|
|
ferencd@0
|
82 void setCipherSuite(const string& cipherSuite);
|
|
ferencd@0
|
83
|
|
ferencd@0
|
84 /** Returns the cipher suite preferences for a SSL/TLS session, as
|
|
ferencd@0
|
85 * a character string. The format and meaning of the string depend
|
|
ferencd@0
|
86 * on the underlying TLS library (see setCipherSuite() method).
|
|
ferencd@0
|
87 *
|
|
ferencd@0
|
88 * @return cipher suite string
|
|
ferencd@0
|
89 */
|
|
ferencd@0
|
90 const string getCipherSuite() const;
|
|
ferencd@0
|
91
|
|
ferencd@0
|
92 private:
|
|
ferencd@0
|
93
|
|
ferencd@0
|
94 shared_ptr <object> m_data;
|
|
ferencd@0
|
95 };
|
|
ferencd@0
|
96
|
|
ferencd@0
|
97
|
|
ferencd@0
|
98 } // tls
|
|
ferencd@0
|
99 } // net
|
|
ferencd@0
|
100 } // vmime
|
|
ferencd@0
|
101
|
|
ferencd@0
|
102
|
|
ferencd@0
|
103 #endif // VMIME_HAVE_MESSAGING_FEATURES && VMIME_HAVE_TLS_SUPPORT
|
|
ferencd@0
|
104
|
|
ferencd@0
|
105 #endif // VMIME_NET_TLS_TLSPROPERTIES_HPP_INCLUDED
|