MongoDB C++ Driver current
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
35
36namespace mongocxx {
37namespace v_noabi {
38
43 public:
54
59
64
69
70 client_encryption(client_encryption const&) = delete;
71 client_encryption& operator=(client_encryption const&) = delete;
72
90 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::types::bson_value::value)
91 create_data_key(std::string kms_provider, options::data_key const& opts = {});
92
109 database const& db,
110 std::string const& coll_name,
111 bsoncxx::v_noabi::document::view const& options,
112 bsoncxx::v_noabi::document::value& out_options,
113 std::string const& kms_provider,
114 bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::view> const& masterkey =
115 bsoncxx::v_noabi::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, options::encrypt const& opts);
135
147 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::document::value)
148 encrypt_expression(bsoncxx::v_noabi::document::view_or_value expr, options::encrypt const& opts);
149
163 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::types::bson_value::value)
164 decrypt(bsoncxx::v_noabi::types::bson_value::view value);
165
188 rewrap_many_datakey(bsoncxx::v_noabi::document::view_or_value filter, options::rewrap_many_datakey const& opts);
189
203 MONGOCXX_ABI_EXPORT_CDECL(result::delete_result)
204 delete_key(bsoncxx::v_noabi::types::bson_value::view_or_value id);
205
218 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::value>)
219 get_key(bsoncxx::v_noabi::types::bson_value::view_or_value id);
220
232
248 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::value>)
250 bsoncxx::v_noabi::types::bson_value::view_or_value id,
251 bsoncxx::v_noabi::string::view_or_value key_alt_name);
252
268 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::value>)
270 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(bsoncxx::v_noabi::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
Supports MongoDB Client-Side Field Level Encryption operations.
Definition client_encryption.hpp:42
bsoncxx::v_noabi::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.
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).
result::rewrap_many_datakey rewrap_many_datakey(bsoncxx::v_noabi::document::view_or_value filter, options::rewrap_many_datakey const &opts)
Decrypts multiple data keys and (re-)encrypts them with a new masterKey, or with their current master...
bsoncxx::v_noabi::types::bson_value::value create_data_key(std::string kms_provider, options::data_key const &opts={})
Creates a new key document and inserts into the key vault collection.
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::types::bson_value::value encrypt(bsoncxx::v_noabi::types::bson_value::view value, options::encrypt const &opts)
Encrypts a BSON value with a given key and algorithm.
bsoncxx::v_noabi::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::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 ...
bsoncxx::v_noabi::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).
collection create_encrypted_collection(database const &db, std::string const &coll_name, bsoncxx::v_noabi::document::view const &options, bsoncxx::v_noabi::document::value &out_options, std::string const &kms_provider, bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::document::view > const &masterkey=bsoncxx::v_noabi::stdx::nullopt)
Create a collection with client-side-encryption enabled, automatically filling any datakeys for encry...
bsoncxx::v_noabi::document::value encrypt_expression(bsoncxx::v_noabi::document::view_or_value expr, options::encrypt const &opts)
Encrypts a Match Expression or Aggregate Expression to query a range index.
mongocxx::v_noabi::cursor get_keys()
Finds all documents in the key vault collection.
A MongoDB collection.
Definition collection.hpp:87
A cursor over the documents returned by a query to a MongoDB server.
Definition cursor.hpp:42
A MongoDB database.
Definition database.hpp:46
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 export.hpp:52
The mongocxx v_noabi 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.
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.
Provides bsoncxx::v_noabi::types::bson_value::value.
Provides bsoncxx::v_noabi::types::bson_value::view.