Kea 2.7.4
botan_tls.h
Go to the documentation of this file.
1// Copyright (C) 2021-2024 Internet Systems Consortium, Inc. ("ISC")
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7// Do not include this header directly: use crypto_tls.h instead.
8
9#ifndef BOTAN_TLS_H
10#define BOTAN_TLS_H
11
13
14#if defined(WITH_BOTAN) && !defined(WITH_BOTAN_BOOST)
15
18#include <asiolink/io_service.h>
19#include <asiolink/common_tls.h>
20
22
23namespace isc {
24namespace asiolink {
25
27class TlsContext : public TlsContextBase {
28public:
29
31 virtual ~TlsContext() { }
32
36 explicit TlsContext(TlsRole role);
37
42 virtual bool getCertRequired() const;
43
44protected:
49 virtual void setCertRequired(bool cert_required);
50
56 virtual void loadCaFile(const std::string& ca_file);
57
63 virtual void loadCaPath(const std::string& ca_path);
64
70 virtual void loadCertFile(const std::string& cert_file);
71
77 virtual void loadKeyFile(const std::string& key_file);
78
80 bool cert_required_;
81
83 friend class TlsContextBase;
84};
85
87typedef boost::asio::ip::tcp::socket TlsStreamImpl;
88
96template <typename Callback, typename TlsStreamImpl>
98TlsStreamBase(const IOServicePtr& io_service, TlsContextPtr context)
99 : StreamService(io_service, context),
100 TlsStreamImpl(io_service->getInternalIOService()),
101 role_(context->getRole()) {
102}
103
107template <typename Callback>
108class TlsStream : public TlsStreamBase<Callback, TlsStreamImpl> {
109public:
110
112 typedef TlsStreamBase<Callback, TlsStreamImpl> Base;
113
119 TlsStream(const IOServicePtr& service, TlsContextPtr context)
120 : Base(service, context) {
121 }
122
124 virtual ~TlsStream() { }
125
127 virtual void handshake(Callback&) {
128 isc_throw(NotImplemented, "Botan TLS is not yet supported");
129 }
130
132 virtual void shutdown(Callback&) {
133 isc_throw(NotImplemented, "Botan TLS is not yet supported");
134 }
135
146 std::string getSubject() {
147 return ("");
148 }
149
160 std::string getIssuer() {
161 return ("");
162 }
163};
164
165} // namespace asiolink
166} // namespace isc
167
168#endif // WITH_BOTAN && !WITH_BOTAN_BOOST
169
170#endif // BOTAN_TLS_H
Common TLS API.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
Defines the logger used by the top-level component of kea-lfc.