MongoDB C++ Driver current
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 {
26inline namespace v_noabi {
27namespace options {
28
32class MONGOCXX_API tls {
33 public:
45 tls& pem_file(bsoncxx::string::view_or_value pem_file);
46
52 const stdx::optional<bsoncxx::string::view_or_value>& pem_file() const;
53
64 tls& pem_password(bsoncxx::string::view_or_value pem_password);
65
71 const stdx::optional<bsoncxx::string::view_or_value>& pem_password() const;
72
84 tls& ca_file(bsoncxx::string::view_or_value ca_file);
85
91 const stdx::optional<bsoncxx::string::view_or_value>& ca_file() const;
92
103 tls& ca_dir(bsoncxx::string::view_or_value ca_dir);
104
110 const stdx::optional<bsoncxx::string::view_or_value>& ca_dir() const;
111
122 tls& crl_file(bsoncxx::string::view_or_value crl_file);
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
160} // namespace v_noabi
161} // namespace mongocxx
162
163#include <mongocxx/config/postlude.hpp>
Class representing the optional arguments to a MongoDB driver client (TLS)
Definition tls.hpp:32
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.
tls & crl_file(bsoncxx::string::view_or_value crl_file)
The path to the .pem file that contains revoked certificates.
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 & allow_invalid_certificates(bool allow_invalid_certificates)
If true, the driver will not verify 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_password(bsoncxx::string::view_or_value pem_password)
The pass phrase used to decrypt an encrypted PEM file.
const stdx::optional< bsoncxx::string::view_or_value > & ca_dir() const
Retrieves the current path to the CA directory.
const stdx::optional< bsoncxx::string::view_or_value > & pem_password() const
Retrieves the current decryption pass phrase.
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 > & crl_file() const
Retrieves the current 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.
The top-level namespace for mongocxx library entities.
Definition bulk_write.hpp:24