MongoDB C++ Driver mongocxx-3.0.3
Loading...
Searching...
No Matches
ssl.hpp
1// Copyright 2014 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 ssl {
33 public:
42
48 const stdx::optional<bsoncxx::string::view_or_value>& pem_file() const;
49
57
63 const stdx::optional<bsoncxx::string::view_or_value>& pem_password() const;
64
73
79 const stdx::optional<bsoncxx::string::view_or_value>& ca_file() const;
80
88
94 const stdx::optional<bsoncxx::string::view_or_value>& ca_dir() const;
95
103
109 const stdx::optional<bsoncxx::string::view_or_value>& crl_file() const;
110
117 ssl& allow_invalid_certificates(bool allow_invalid_certificates);
118
124 const stdx::optional<bool>& allow_invalid_certificates() const;
125
126 private:
127 stdx::optional<bsoncxx::string::view_or_value> _pem_file;
128 stdx::optional<bsoncxx::string::view_or_value> _pem_password;
129 stdx::optional<bsoncxx::string::view_or_value> _ca_file;
130 stdx::optional<bsoncxx::string::view_or_value> _ca_dir;
131 stdx::optional<bsoncxx::string::view_or_value> _crl_file;
132 stdx::optional<bool> _allow_invalid_certificates;
133};
134
135} // namespace options
136MONGOCXX_INLINE_NAMESPACE_END
137} // namespace mongocxx
138
139#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 (SSL)
Definition ssl.hpp:32
ssl & 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.
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 > & ca_dir() const
Retrieves the current path to the CA directory.
const stdx::optional< bool > & allow_invalid_certificates() const
Retrieves whether or not the driver will check the server's CA 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 > & pem_file() const
Retrieves the current path to the .pem file.
ssl & ca_dir(bsoncxx::string::view_or_value ca_dir)
The path to the Certificate Authority directory.
ssl & allow_invalid_certificates(bool allow_invalid_certificates)
If false, the driver will not verify the server's CA file.
ssl & 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.
ssl & crl_file(bsoncxx::string::view_or_value crl_file)
The path to the .pem file that contains revoked certificates.
ssl & 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 > & pem_password() const
Retrieves the current decryption pass phrase.