MongoDB C++ Driver mongocxx-3.7.0
Loading...
Searching...
No Matches
tls.hpp
1// Copyright 2019 MongoDB Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#pragma once
16
17#include <string>
18
19#include <bsoncxx/stdx/optional.hpp>
20#include <bsoncxx/string/view_or_value.hpp>
21#include <mongocxx/stdx.hpp>
22
23#include <mongocxx/config/prelude.hpp>
24
25namespace mongocxx {
26MONGOCXX_INLINE_NAMESPACE_BEGIN
27namespace options {
28
32class MONGOCXX_API tls {
33 public:
46
52 const stdx::optional<bsoncxx::string::view_or_value>& pem_file() const;
53
65
71 const stdx::optional<bsoncxx::string::view_or_value>& pem_password() const;
72
85
91 const stdx::optional<bsoncxx::string::view_or_value>& ca_file() const;
92
104
110 const stdx::optional<bsoncxx::string::view_or_value>& ca_dir() const;
111
123
129 const stdx::optional<bsoncxx::string::view_or_value>& crl_file() const;
130
141 tls& allow_invalid_certificates(bool allow_invalid_certificates);
142
148 const stdx::optional<bool>& allow_invalid_certificates() const;
149
150 private:
151 stdx::optional<bsoncxx::string::view_or_value> _pem_file;
152 stdx::optional<bsoncxx::string::view_or_value> _pem_password;
153 stdx::optional<bsoncxx::string::view_or_value> _ca_file;
154 stdx::optional<bsoncxx::string::view_or_value> _ca_dir;
155 stdx::optional<bsoncxx::string::view_or_value> _crl_file;
156 stdx::optional<bool> _allow_invalid_certificates;
157};
158
159} // namespace options
160MONGOCXX_INLINE_NAMESPACE_END
161} // namespace mongocxx
162
163#include <mongocxx/config/postlude.hpp>
Class representing a view-or-value variant type for strings.
Definition view_or_value.hpp:36
Class representing the optional arguments to a MongoDB driver client (TLS)
Definition tls.hpp:32
tls & allow_invalid_certificates(bool allow_invalid_certificates)
If true, the driver will not verify the server's CA file.
const stdx::optional< bsoncxx::string::view_or_value > & crl_file() const
Retrieves the current path to the .pem file that contains revoked certificates.
const stdx::optional< bsoncxx::string::view_or_value > & pem_file() const
Retrieves the current path to the .pem file.
const stdx::optional< bsoncxx::string::view_or_value > & ca_file() const
Retrieves the current path to the CA file.
const stdx::optional< bsoncxx::string::view_or_value > & ca_dir() const
Retrieves the current path to the CA directory.
tls & crl_file(bsoncxx::string::view_or_value crl_file)
The path to the .pem file that contains revoked certificates.
const stdx::optional< bool > & allow_invalid_certificates() const
Retrieves whether or not the driver will check the server's CA file.
tls & ca_file(bsoncxx::string::view_or_value ca_file)
The path to the .pem file that contains the root certificate chain from the Certificate Authority.
tls & pem_file(bsoncxx::string::view_or_value pem_file)
The path to the .pem file containing a public key certificate and its associated private key.
tls & ca_dir(bsoncxx::string::view_or_value ca_dir)
The path to the Certificate Authority directory.
const stdx::optional< bsoncxx::string::view_or_value > & pem_password() const
Retrieves the current decryption pass phrase.
tls & pem_password(bsoncxx::string::view_or_value pem_password)
The pass phrase used to decrypt an encrypted PEM file.
Top level namespace for the MongoDB C++ driver.
Definition bulk_write.hpp:24