summaryrefslogtreecommitdiff
path: root/src/LibsslTLSContext.h
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2008-11-08 10:48:02 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2008-11-08 10:48:02 +0000
commit52316b09723bb004d2479fa897677eaa62e28d57 (patch)
treef245de8a8662075230f5070065bb351a11346e24 /src/LibsslTLSContext.h
parent5c4910f71e7002c4f5dc5977be27b84d65609c27 (diff)
2008-11-08 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Introduced TLSContext that holds TLS related data that can be shared with multiple SSL connections. * src/DownloadEngineFactory.cc * src/LibgnutlsTLSContext.cc * src/LibgnutlsTLSContext.h * src/LibsslTLSContext.cc * src/LibsslTLSContext.h * src/Makefile.am * src/SocketCore.cc * src/SocketCore.h * src/TLSContext.h * src/message.h
Diffstat (limited to 'src/LibsslTLSContext.h')
-rw-r--r--src/LibsslTLSContext.h78
1 files changed, 78 insertions, 0 deletions
diff --git a/src/LibsslTLSContext.h b/src/LibsslTLSContext.h
new file mode 100644
index 00000000..8e41bcf0
--- /dev/null
+++ b/src/LibsslTLSContext.h
@@ -0,0 +1,78 @@
+/* <!-- copyright */
+/*
+ * aria2 - The high speed download utility
+ *
+ * Copyright (C) 2006 Tatsuhiro Tsujikawa
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * In addition, as a special exception, the copyright holders give
+ * permission to link the code of portions of this program with the
+ * OpenSSL library under certain conditions as described in each
+ * individual source file, and distribute linked combinations
+ * including the two.
+ * You must obey the GNU General Public License in all respects
+ * for all of the code used other than OpenSSL. If you modify
+ * file(s) with this exception, you may extend this exception to your
+ * version of the file(s), but you are not obligated to do so. If you
+ * do not wish to do so, delete this exception statement from your
+ * version. If you delete this exception statement from all source
+ * files in the program, then also delete it here.
+ */
+/* copyright --> */
+#ifndef _D_LIBSSL_TLS_CONTEXT_H_
+#define _D_LIBSSL_TLS_CONTEXT_H_
+
+#include "common.h"
+
+#include <string>
+
+# include <openssl/ssl.h>
+
+#include "DlAbortEx.h"
+
+namespace aria2 {
+
+class Logger;
+
+class TLSContext {
+private:
+ SSL_CTX* _sslCtx;
+
+ bool _good;
+
+ Logger* _logger;
+public:
+ TLSContext();
+
+ ~TLSContext();
+
+ // private key `keyfile' must be decrypted.
+ void addClientKeyFile(const std::string& certfile,
+ const std::string& keyfile) throw(DlAbortEx);
+
+ // certfile can contain multiple certificates.
+ void addTrustedCACertFile(const std::string& certfile) throw(DlAbortEx);
+
+ bool good() const;
+
+ bool bad() const;
+
+ SSL_CTX* getSSLCtx() const;
+};
+
+} // namespace aria2
+
+#endif // _D_LIBSSL_TLS_CONTEXT_H_