MongoDB C++ Driver mongocxx-3.11.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 <string>
18
22
25
26#include <mongocxx/cursor.hpp>
33#include <mongocxx/stdx.hpp>
34
36
37namespace mongocxx {
38namespace v_noabi {
39
44 public:
55
60
65
70
71 client_encryption(const client_encryption&) = delete;
72 client_encryption& operator=(const client_encryption&) = delete;
73
91 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::types::bson_value::value)
92 create_data_key(std::string kms_provider, const options::data_key& opts = {});
93
110 const database& db,
111 const std::string& coll_name,
112 const bsoncxx::v_noabi::document::view& options,
113 bsoncxx::v_noabi::document::value& out_options,
114 const std::string& kms_provider,
115 const stdx::optional<bsoncxx::v_noabi::document::view>& masterkey = stdx::nullopt);
116
133 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::types::bson_value::value)
134 encrypt(bsoncxx::v_noabi::types::bson_value::view value, const options::encrypt& opts);
135
147 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::document::value)
148 encrypt_expression(bsoncxx::v_noabi::document::view_or_value expr,
149 const options::encrypt& opts);
150
164 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::types::bson_value::value)
165 decrypt(bsoncxx::v_noabi::types::bson_value::view value);
166
189 rewrap_many_datakey(bsoncxx::v_noabi::document::view_or_value filter,
190 const options::rewrap_many_datakey& opts);
191
205 MONGOCXX_ABI_EXPORT_CDECL(result::delete_result)
206 delete_key(bsoncxx::v_noabi::types::bson_value::view_or_value id);
207
220 MONGOCXX_ABI_EXPORT_CDECL(stdx::optional<bsoncxx::v_noabi::document::value>)
221 get_key(bsoncxx::v_noabi::types::bson_value::view_or_value id);
222
234
250 MONGOCXX_ABI_EXPORT_CDECL(stdx::optional<bsoncxx::v_noabi::document::value>)
251 add_key_alt_name(bsoncxx::v_noabi::types::bson_value::view_or_value id,
252 bsoncxx::v_noabi::string::view_or_value key_alt_name);
253
269 MONGOCXX_ABI_EXPORT_CDECL(stdx::optional<bsoncxx::v_noabi::document::value>)
270 remove_key_alt_name(bsoncxx::v_noabi::types::bson_value::view_or_value id,
271 bsoncxx::v_noabi::string::view_or_value key_alt_name);
272
285 MONGOCXX_ABI_EXPORT_CDECL(stdx::optional<bsoncxx::v_noabi::document::value>)
286 get_key_by_alt_name(bsoncxx::v_noabi::string::view_or_value key_alt_name);
287
288 private:
289 class impl;
290
291 std::unique_ptr<impl> _impl;
292};
293
294} // namespace v_noabi
295} // namespace mongocxx
296
297#include <mongocxx/config/postlude.hpp>
298
Class supporting operations for MongoDB Client-Side Field Level Encryption.
Definition client_encryption.hpp:43
bsoncxx::v_noabi::types::bson_value::value decrypt(bsoncxx::v_noabi::types::bson_value::view value)
Decrypts an encrypted value (BSON binary of subtype 6).
bsoncxx::v_noabi::types::bson_value::value create_data_key(std::string kms_provider, const options::data_key &opts={})
Creates a new key document and inserts into the key vault collection.
stdx::optional< bsoncxx::v_noabi::document::value > get_key(bsoncxx::v_noabi::types::bson_value::view_or_value id)
Finds a single key document with the given UUID (BSON binary subtype 0x04).
stdx::optional< bsoncxx::v_noabi::document::value > get_key_by_alt_name(bsoncxx::v_noabi::string::view_or_value key_alt_name)
Get the key document from the key vault collection with the provided name.
result::delete_result delete_key(bsoncxx::v_noabi::types::bson_value::view_or_value id)
Removes the key document with the given UUID (BSON binary subtype 0x04) from the key vault collection...
bsoncxx::v_noabi::document::value encrypt_expression(bsoncxx::v_noabi::document::view_or_value expr, const options::encrypt &opts)
Encrypts a Match Expression or Aggregate Expression to query a range index.
stdx::optional< bsoncxx::v_noabi::document::value > remove_key_alt_name(bsoncxx::v_noabi::types::bson_value::view_or_value id, bsoncxx::v_noabi::string::view_or_value key_alt_name)
Removes a keyAltName from the keyAltNames array of the key document in the key vault collection with ...
result::rewrap_many_datakey rewrap_many_datakey(bsoncxx::v_noabi::document::view_or_value filter, const options::rewrap_many_datakey &opts)
Decrypts multiple data keys and (re-)encrypts them with a new masterKey, or with their current master...
mongocxx::v_noabi::cursor get_keys()
Finds all documents in the key vault collection.
stdx::optional< bsoncxx::v_noabi::document::value > add_key_alt_name(bsoncxx::v_noabi::types::bson_value::view_or_value id, bsoncxx::v_noabi::string::view_or_value key_alt_name)
Adds a keyAltName to the keyAltNames array of the key document in the key vault collection with the g...
bsoncxx::v_noabi::types::bson_value::value encrypt(bsoncxx::v_noabi::types::bson_value::view value, const options::encrypt &opts)
Encrypts a BSON value with a given key and algorithm.
collection create_encrypted_collection(const database &db, const std::string &coll_name, const bsoncxx::v_noabi::document::view &options, bsoncxx::v_noabi::document::value &out_options, const std::string &kms_provider, const stdx::optional< bsoncxx::v_noabi::document::view > &masterkey=stdx::nullopt)
Create a collection with client-side-encryption enabled, automatically filling any datakeys for encry...
Class representing server side document groupings within a MongoDB database.
Definition collection.hpp:87
Class representing a pointer to the result set of a query on a MongoDB server.
Definition cursor.hpp:42
Class representing a MongoDB database.
Definition database.hpp:47
Declares mongocxx::v_noabi::client_encryption.
Declares mongocxx::v_noabi::collection.
Provides mongocxx::v_noabi::cursor.
Provides mongocxx::v_noabi::options::data_key.
Declares mongocxx::v_noabi::database.
Provides mongocxx::v_noabi::options::encrypt.
#define MONGOCXX_ABI_EXPORT_CDECL(...)
Equivalent to MONGOCXX_ABI_EXPORT with MONGOCXX_ABI_CDECL.
Definition fwd.hpp:222
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 mongocxx::v_noabi::options::client_encryption.
Provides mongocxx::v_noabi::options::rewrap_many_datakey.
Provides mongocxx::v_noabi::result::delete_result.
Provides mongocxx::v_noabi::result::rewrap_many_datakey.
Redeclares bsoncxx::v_noabi::stdx in mongocxx::v_noabi::stdx for internal use.
Provides bsoncxx::v_noabi::types::bson_value::value.
Provides bsoncxx::v_noabi::types::bson_value::view.