MongoDB C++ Driver current
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 <mongocxx/options/encrypt-fwd.hpp> // IWYU pragma: export
18
19//
20
22
23#include <mongocxx/v1/encrypt_options.hpp> // IWYU pragma: export
24
25#include <cstdint>
26#include <string>
27#include <utility>
28
29#include <mongocxx/client_encryption-fwd.hpp> // IWYU pragma: keep: backward compatibility, to be removed.
30
32#include <bsoncxx/types.hpp> // IWYU pragma: keep: backward compatibility, to be removed.
35
39
41
42namespace mongocxx {
43namespace v_noabi {
44namespace options {
45
49class encrypt {
50 public:
54 encrypt() = default;
55
60
65
83 encrypt& key_id(bsoncxx::v_noabi::types::bson_value::view_or_value key_id) {
84 _key_id = std::move(key_id);
85 return *this;
86 }
87
97
111 encrypt& key_alt_name(std::string name) {
112 _key_alt_name = std::move(name);
113 return *this;
114 }
115
123 return _key_alt_name;
124 }
125
131
137
155 _algorithm = algorithm;
156 return *this;
157 }
158
168 return _algorithm;
169 }
170
180 _contention_factor = contention_factor;
181 return *this;
182 }
183
191 return _contention_factor;
192 }
193
203 _query_type = query_type;
204 return *this;
205 }
206
214 return _query_type;
215 }
216
221 _range_opts = std::move(opts);
222 return *this;
223 }
224
232 return _range_opts;
233 }
234
239 _string_opts = std::move(opts);
240 return *this;
241 }
242
247 return _string_opts;
248 }
249
256 _text_opts = std::move(opts);
257 return *this;
258 }
259
268
269 class internal;
270
271 private:
280};
281
282} // namespace options
283} // namespace v_noabi
284} // namespace mongocxx
285
286namespace mongocxx {
287namespace v_noabi {
288
293 return {std::move(v)};
294}
295
302
303} // namespace v_noabi
304} // namespace mongocxx
305
307
A polyfill for std::optional<T>.
Definition optional.hpp:799
encrypt()=default
Default initialization.
Options related to explicit encryption for In-Use Encryption.
Definition encrypt_options.hpp:62
encryption_algorithm
An encryption algorithm.
Definition encrypt_options.hpp:77
encryption_query_type
A query type.
Definition encrypt_options.hpp:102
Options related to string queries for Queryable Encryption.
Definition string_options.hpp:46
Options related to text queries for Queryable Encryption.
Definition text_options.hpp:50
Used by mongocxx::v_noabi::client_encryption.
Definition encrypt.hpp:49
bsoncxx::v_noabi::stdx::optional< std::string > const & key_alt_name() const
Gets the current key alt name.
Definition encrypt.hpp:122
operator v1::encrypt_options() const
Convert to the mongocxx::v1 equivalent.
encrypt & key_id(bsoncxx::v_noabi::types::bson_value::view_or_value key_id)
Sets the key to use for this encryption operation. A key id can be used instead of a key alt name.
Definition encrypt.hpp:83
bsoncxx::v_noabi::stdx::optional< v1::text_options > const & text_opts() const
Gets the current text options.
Definition encrypt.hpp:265
encrypt & algorithm(encryption_algorithm algorithm)
Sets the algorithm to use for encryption.
Definition encrypt.hpp:154
encrypt & key_alt_name(std::string name)
Sets a name by which to lookup a key from the key vault collection to use for this encryption operati...
Definition encrypt.hpp:111
v1::encrypt_options::encryption_query_type encryption_query_type
queryType only applies when algorithm is "indexed" or "range". It is an error to set queryType when a...
Definition encrypt.hpp:136
encrypt & query_type(encryption_query_type query_type)
Sets the query type to use for encryption.
Definition encrypt.hpp:202
v1::encrypt_options::encryption_algorithm encryption_algorithm
Determines which AEAD_AES_256_CBC algorithm to use with HMAC_SHA_512 when encrypting data.
Definition encrypt.hpp:130
bsoncxx::v_noabi::stdx::optional< options::range > const & range_opts() const
Gets the current range options.
Definition encrypt.hpp:231
bsoncxx::v_noabi::stdx::optional< encryption_query_type > const & query_type() const
Gets the current query type.
Definition encrypt.hpp:213
encrypt & string_opts(v1::string_options opts)
Sets the string options to use for encryption.
Definition encrypt.hpp:238
bsoncxx::v_noabi::stdx::optional< std::int64_t > const & contention_factor() const
Gets the current contention factor.
Definition encrypt.hpp:190
encrypt & contention_factor(std::int64_t contention_factor)
Sets the contention factor to use for encryption. contentionFactor only applies when algorithm is "In...
Definition encrypt.hpp:179
encrypt & range_opts(options::range opts)
Sets the range options to use for encryption.
Definition encrypt.hpp:220
encrypt & text_opts(v1::text_options opts)
Sets the text options to use for encryption.
Definition encrypt.hpp:255
encrypt()=default
Default initialization.
bsoncxx::v_noabi::stdx::optional< encryption_algorithm > const & algorithm() const
Gets the current algorithm.
Definition encrypt.hpp:167
bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::types::bson_value::view_or_value > const & key_id() const
Gets the key_id.
Definition encrypt.hpp:94
bsoncxx::v_noabi::stdx::optional< v1::string_options > const & string_opts() const
Gets the current string options.
Definition encrypt.hpp:246
Used by mongocxx::v_noabi::options::encrypt::range_opts.
Definition range.hpp:51
Declares mongocxx::v_noabi::options::encrypt.
Provides mongocxx::v1::encrypt_options.
#define MONGOCXX_DEPRECATED
Declares the associated entity as deprecated.
Definition export.hpp:25
#define MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE(...)
Equivalent to MONGOCXX_ABI_EXPORT_UNSTABLE with MONGOCXX_ABI_CDECL.
Definition config.hpp:28
The mongocxx v_noabi macro guard postlude header.
The mongocxx v_noabi macro guard prelude header.
The top-level namespace within which all bsoncxx library entities are declared.
Declares entities whose ABI stability is guaranteed for documented symbols.
Declares entities representing options to use with various commands.
Declares entities whose ABI stability is NOT guaranteed.
v1::bulk_write to_v1(v_noabi::bulk_write v)
Convert to the mongocxx::v1 equivalent of v.
Definition bulk_write.hpp:162
v_noabi::bulk_write from_v1(v1::bulk_write v)
Convert to the mongocxx::v_noabi equivalent of v.
Definition bulk_write.hpp:155
The top-level namespace within which all mongocxx library entities are declared.
Provides mongocxx::v_noabi::options::range.
Provides mongocxx::text_options.
Provides bsoncxx::v_noabi::types::bson_value::view_or_value.
Provides entities used to represent BSON types.
Provides bsoncxx::v1::types::value.
Provides std::optional-related polyfills for library API usage.
Provides bsoncxx::v_noabi::types::bson_value::view.
Declares mongocxx::v_noabi::client_encryption.
Provides mongocxx::string_options.