MongoDB C++ Driver mongocxx-4.0.0
Loading...
Searching...
No Matches
encrypt.hpp
Go to the documentation of this file.
1// Copyright 2009-present 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
21
23#include <bsoncxx/types.hpp>
25
27
29
30namespace mongocxx {
31namespace v_noabi {
32namespace options {
33
37class encrypt {
38 public:
57 key_id(bsoncxx::v_noabi::types::bson_value::view_or_value key_id);
58
66 const bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::types::bson_value::view_or_value>&)
67 key_id() const;
68
83
90 MONGOCXX_ABI_EXPORT_CDECL(const bsoncxx::v_noabi::stdx::optional<std::string>&)
91 key_alt_name() const;
92
97 enum class encryption_algorithm : std::uint8_t {
102
106 k_random,
107
111 k_indexed,
112
117
121 k_range,
122 };
123
128 enum class encryption_query_type : std::uint8_t {
131
133 k_range,
134 };
135
153
163 algorithm() const;
164
174
181 MONGOCXX_ABI_EXPORT_CDECL(const bsoncxx::v_noabi::stdx::optional<int64_t>&)
183
193
200 MONGOCXX_ABI_EXPORT_CDECL(const bsoncxx::v_noabi::stdx::optional<encryption_query_type>&)
201 query_type() const;
202
207
214 MONGOCXX_ABI_EXPORT_CDECL(const bsoncxx::v_noabi::stdx::optional<options::range>&)
215 range_opts() const;
216
217 private:
218 friend ::mongocxx::v_noabi::client_encryption;
219
220 void* convert() const;
221
222 bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::types::bson_value::view_or_value> _key_id;
223 bsoncxx::v_noabi::stdx::optional<std::string> _key_alt_name;
224 bsoncxx::v_noabi::stdx::optional<encryption_algorithm> _algorithm;
225 bsoncxx::v_noabi::stdx::optional<int64_t> _contention_factor;
226 bsoncxx::v_noabi::stdx::optional<encryption_query_type> _query_type;
227 bsoncxx::v_noabi::stdx::optional<options::range> _range_opts;
228};
229
230} // namespace options
231} // namespace v_noabi
232} // namespace mongocxx
233
234#include <mongocxx/config/postlude.hpp>
235
A polyfill for std::optional<T>.
Definition optional.hpp:826
Class representing options for the object managing explicit client-side encryption.
Definition client_encryption.hpp:35
Class representing options for explicit client-side encryption.
Definition encrypt.hpp:37
const bsoncxx::v_noabi::stdx::optional< encryption_algorithm > & algorithm() const
Gets the current algorithm.
const bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::types::bson_value::view_or_value > & key_id() const
Gets the key_id.
encrypt & algorithm(encryption_algorithm algorithm)
Sets the algorithm to use for encryption.
const bsoncxx::v_noabi::stdx::optional< encryption_query_type > & query_type() const
Gets the current query type.
const bsoncxx::v_noabi::stdx::optional< options::range > & range_opts() const
Gets the current range options.
encryption_query_type
queryType only applies when algorithm is "indexed" or "range". It is an error to set queryType when a...
Definition encrypt.hpp:128
const bsoncxx::v_noabi::stdx::optional< int64_t > & contention_factor() const
Gets the current contention factor.
const bsoncxx::v_noabi::stdx::optional< std::string > & key_alt_name() const
Gets the current key alt name.
encryption_algorithm
Determines which AEAD_AES_256_CBC algorithm to use with HMAC_SHA_512 when encrypting data.
Definition encrypt.hpp:97
RangeOpts specifies index options for a Queryable Encryption field supporting "range" queries.
Definition range.hpp:40
Declares mongocxx::v_noabi::client_encryption.
Declares mongocxx::v_noabi::options::encrypt.
#define MONGOCXX_ABI_EXPORT_CDECL(...)
Equivalent to MONGOCXX_ABI_EXPORT with MONGOCXX_ABI_CDECL.
Definition fwd.hpp:204
The mongocxx macro guard prelude header.
The top-level namespace within which all bsoncxx library entities are declared.
The top-level namespace within which all mongocxx library entities are declared.
The top-level namespace reserved for the C++ standard library.
Provides std::optional-related polyfills for library API usage.
Provides mongocxx::v_noabi::options::range.
Provides bsoncxx::v_noabi::types::bson_value::view_or_value.
Provides entities used to represent BSON types.