MongoDB C++ Driver 4.2.0
Loading...
Searching...
No Matches
client_encryption.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/v1/client_encryption-fwd.hpp> // IWYU pragma: export
18
19//
20
22
26
36
39
41
42#include <string>
43#include <utility>
44
45namespace mongocxx {
46namespace v1 {
47
62 private:
63 void* _impl; // mongoc_client_encryption_t
64
65 public:
66 class options;
67
74
82
90
94 client_encryption(client_encryption const& other) = delete;
95
99 client_encryption& operator=(client_encryption const& other) = delete;
100
105
116 bsoncxx::v1::stdx::string_view kms_provider,
117 v1::data_key_options const& opts);
118
119 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::types::value) create_data_key(bsoncxx::v1::stdx::string_view kms_provider);
122
138 v1::database& db,
139 bsoncxx::v1::stdx::string_view name,
140 bsoncxx::v1::document::view opts,
141 bsoncxx::v1::document::value& coll_opts,
142 bsoncxx::v1::stdx::string_view kms_provider,
143 bsoncxx::v1::document::view master_key);
144
159 v1::database& db,
160 bsoncxx::v1::stdx::string_view name,
161 bsoncxx::v1::document::view opts,
162 bsoncxx::v1::document::value& coll_opts,
163 bsoncxx::v1::stdx::string_view kms_provider);
164
174 bsoncxx::v1::types::value value,
175 v1::encrypt_options const& opts);
176
189 bsoncxx::v1::document::view expr,
190 v1::encrypt_options const& opts);
191
198 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::types::value) decrypt(bsoncxx::v1::types::value value);
199
213 bsoncxx::v1::document::view filter,
214 v1::rewrap_many_datakey_options const& opts);
215
223
232 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::document::value) get_key(bsoncxx::v1::types::value id);
233
241
251 bsoncxx::v1::types::value id,
252 bsoncxx::v1::stdx::string_view key_alt_name);
253
263 bsoncxx::v1::types::value id,
264 bsoncxx::v1::stdx::string_view key_alt_name);
265
273 bsoncxx::v1::stdx::string_view key_alt_name);
274
275 class internal;
276
277 private:
278 /* explicit(false) */ client_encryption(void* impl);
279};
280
293 private:
294 class impl;
295 void* _impl;
296
297 public:
304
312
319 MONGOCXX_ABI_EXPORT_CDECL(options&) operator=(options&& other) noexcept;
320
325
329 MONGOCXX_ABI_EXPORT_CDECL(options&) operator=(options const& other);
330
338
347
352
360 using ns_pair = std::pair<std::string, std::string>;
361
366
371
376
380 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bsoncxx::v1::document::view>) kms_providers() const;
381
386
390 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bsoncxx::v1::document::view>) tls_opts() const;
391
392 class internal;
393};
394
395} // namespace v1
396} // namespace mongocxx
397
398#include <mongocxx/v1/detail/postlude.hpp>
399
Options for mongocxx::v1::client_encryption.
Definition client_encryption.hpp:292
options & key_vault_namespace(ns_pair v)
Set the "keyVaultNamespace" field.
options & tls_opts(bsoncxx::v1::document::value v)
Set the "tlsOptions" field.
options & key_vault_client(v1::client *v)
Set the "keyVaultClient" field.
options & kms_providers(bsoncxx::v1::document::value v)
Set the "kmsProviders" field.
options(options &&other) noexcept
Move constructor.
std::pair< std::string, std::string > ns_pair
The name of a database and a collection.
Definition client_encryption.hpp:360
bsoncxx::v1::document::value get_key_by_alt_name(bsoncxx::v1::stdx::string_view key_alt_name)
Return the specified data key.
bsoncxx::v1::types::value create_data_key(bsoncxx::v1::stdx::string_view kms_provider, v1::data_key_options const &opts)
Create a new data key within the key vault collection.
bsoncxx::v1::types::value encrypt(bsoncxx::v1::types::value value, v1::encrypt_options const &opts)
Encrypt the given value.
client_encryption(client_encryption &&other) noexcept
Move constructor.
bsoncxx::v1::document::value remove_key_alt_name(bsoncxx::v1::types::value id, bsoncxx::v1::stdx::string_view key_alt_name)
Remove the given keyAltName from the specified data key.
bsoncxx::v1::document::value encrypt_expression(bsoncxx::v1::document::view expr, v1::encrypt_options const &opts)
Encrypt the given Match Expression or Aggregate Expression.
v1::cursor get_keys()
Return all data keys within the associated key vault collection.
~client_encryption()
Destroy this object.
v1::rewrap_many_datakey_result rewrap_many_datakey(bsoncxx::v1::document::view filter, v1::rewrap_many_datakey_options const &opts)
Decrypt and (re-)encrypt multiple data keys.
v1::collection create_encrypted_collection(v1::database &db, bsoncxx::v1::stdx::string_view name, bsoncxx::v1::document::view opts, bsoncxx::v1::document::value &coll_opts, bsoncxx::v1::stdx::string_view kms_provider, bsoncxx::v1::document::view master_key)
Create a collection with encrypted fields.
bsoncxx::v1::types::value decrypt(bsoncxx::v1::types::value value)
Decrypt the given value.
v1::delete_one_result delete_key(bsoncxx::v1::types::value id)
Delete the specified data key.
bsoncxx::v1::document::value add_key_alt_name(bsoncxx::v1::types::value id, bsoncxx::v1::stdx::string_view key_alt_name)
Add a new keyAltName to the specified data key.
bsoncxx::v1::document::value get_key(bsoncxx::v1::types::value id)
Return the requested data key.
A connection to a MongoDB deployment.
Definition client.hpp:60
A MongoDB collection.
Definition collection.hpp:83
A MongoDB cursor.
Definition cursor.hpp:41
A Data Encryption Key (DEK) for In-Use Encryption.
Definition data_key_options.hpp:50
A MongoDB database.
Definition database.hpp:57
The result of a "deleteOne" operation.
Definition delete_one_result.hpp:42
Options related to explicit encryption for In-Use Encryption.
Definition encrypt_options.hpp:59
Options for a "rewrapManyDataKey" operation.
Definition rewrap_many_datakey_options.hpp:48
The result of a "rewrapManyDataKey" operation.
Definition rewrap_many_datakey_result.hpp:42
Declares mongocxx::v1::data_key_options.
Declares mongocxx::v1::delete_one_result.
Declares mongocxx::v1::encrypt_options.
Provides macros to control the set of symbols exported in the ABI.
#define MONGOCXX_ABI_EXPORT_CDECL(...)
Equivalent to MONGOCXX_ABI_EXPORT with MONGOCXX_ABI_CDECL.
Definition export.hpp:52
The mongocxx v1 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.
The top-level namespace within which all mongocxx library entities are declared.
Declares mongocxx::v1::rewrap_many_datakey_options.
Declares mongocxx::v1::rewrap_many_datakey_result.
Declares mongocxx::v1::client.
Declares mongocxx::v1::client_encryption.
Declares mongocxx::v1::collection.
Declares mongocxx::v1::cursor.
Declares mongocxx::v1::database.
Declares bsoncxx::v1::document::value.
Declares bsoncxx::v1::document::view.
Provides std::optional-related polyfills for library API usage.
Provides std::string_view-related polyfills for library API usage.
Declares bsoncxx::v1::types::value.