1 // Copyright (C) 2021 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 /// @file botan_tls.cc Botan fake implementation of the TLS API.
8 
9 #include <config.h>
10 
11 #if defined(WITH_BOTAN) && !defined(WITH_BOTAN_BOOST)
12 
13 #include <asiolink/asio_wrapper.h>
14 #include <asiolink/crypto_tls.h>
15 
16 namespace isc {
17 namespace asiolink {
18 
TlsContext(TlsRole role)19 TlsContext::TlsContext(TlsRole role)
20     : TlsContextBase(role), cert_required_(true) {
21 }
22 
23 void
setCertRequired(bool cert_required)24 TlsContext::setCertRequired(bool cert_required) {
25     if (!cert_required && (getRole() == TlsRole::CLIENT)) {
26         isc_throw(BadValue,
27                   "'cert-required' parameter must be true for a TLS client");
28     }
29     cert_required_ = cert_required;
30 }
31 
32 bool
getCertRequired() const33 TlsContext::getCertRequired() const {
34     return (cert_required_);
35 }
36 
37 void
loadCaFile(const std::string &)38 TlsContext::loadCaFile(const std::string&) {
39     isc_throw(NotImplemented, "Botan TLS is not yet supported");
40 }
41 
42 void
loadCaPath(const std::string &)43 TlsContext::loadCaPath(const std::string&) {
44     isc_throw(NotImplemented, "loadCaPath is not implemented by Botan");
45 }
46 
47 void
loadCertFile(const std::string &)48 TlsContext::loadCertFile(const std::string&) {
49     isc_throw(NotImplemented, "Botan TLS is not yet supported");
50 }
51 
52 void
loadKeyFile(const std::string &)53 TlsContext::loadKeyFile(const std::string&) {
54     isc_throw(NotImplemented, "Botan TLS is not yet supported");
55 }
56 
57 } // namespace asiolink
58 } // namespace isc
59 
60 #endif // WITH_BOTAN && !WITH_BOTAN_BOOST
61