00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _DECAF_INTERNAL_NET_SSL_OPENSSL_OPENSSLPARAMETERS_H_
00019 #define _DECAF_INTERNAL_NET_SSL_OPENSSL_OPENSSLPARAMETERS_H_
00020
00021 #include <decaf/util/Config.h>
00022
00023 #include <string>
00024 #include <vector>
00025
00026 #ifdef HAVE_OPENSSL
00027 #include <openssl/ssl.h>
00028 #endif
00029
00030 namespace decaf {
00031 namespace internal {
00032 namespace net {
00033 namespace ssl {
00034 namespace openssl {
00035
00041 class OpenSSLParameters {
00042 private:
00043
00044 bool needClientAuth;
00045 bool wantClientAuth;
00046 bool useClientMode;
00047
00048 #ifdef HAVE_OPENSSL
00049 SSL_CTX* context;
00050 SSL* ssl;
00051 #endif
00052
00053 std::vector<std::string> enabledCipherSuites;
00054 std::vector<std::string> enabledProtocols;
00055 std::vector<std::string> serverNames;
00056
00057 private:
00058
00059 OpenSSLParameters(const OpenSSLParameters&);
00060 OpenSSLParameters& operator=(const OpenSSLParameters&);
00061
00062 public:
00063
00064 #ifdef HAVE_OPENSSL
00065 OpenSSLParameters(SSL_CTX* context);
00066 #endif
00067
00068 virtual ~OpenSSLParameters();
00069
00070 bool getNeedClientAuth() const {
00071 return this->needClientAuth;
00072 }
00073
00074 void setNeedClientAuth( bool value ) {
00075 this->needClientAuth = value;
00076 this->wantClientAuth = false;
00077 }
00078
00079 bool getWantClientAuth() const {
00080 return this->wantClientAuth;
00081 }
00082
00083 void setWantClientAuth( bool value ) {
00084 this->wantClientAuth = value;
00085 this->needClientAuth = false;
00086 }
00087
00088 bool getUseClientMode() const {
00089 return this->useClientMode;
00090 }
00091
00092 void setUseClientMode( bool value ) {
00093 this->useClientMode = value;
00094 }
00095
00096 std::vector<std::string> getSupportedCipherSuites() const;
00097
00098 std::vector<std::string> getSupportedProtocols() const;
00099
00100 std::vector<std::string> getEnabledCipherSuites() const;
00101
00102 void setEnabledCipherSuites(const std::vector<std::string>& suites);
00103
00104 std::vector<std::string> getEnabledProtocols() const;
00105
00106 void setEnabledProtocols(const std::vector<std::string>& protocols);
00107
00108 std::vector<std::string> getServerNames() const;
00109
00110 void setServerNames(const std::vector<std::string>& serverNames);
00111
00112 #ifdef HAVE_OPENSSL
00113
00114 SSL_CTX* getSSLContext() const {
00115 return this->context;
00116 }
00117
00118 SSL* getSSL() const {
00119 return this->ssl;
00120 }
00121
00122 #endif
00123
00128 OpenSSLParameters* clone() const;
00129
00130 };
00131
00132 }}}}}
00133
00134 #endif