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/client_encryption-fwd.hpp> // IWYU pragma: export
18
19//
20
21#include <mongocxx/v1/client_encryption.hpp> // IWYU pragma: export
22
23#include <string>
24#include <utility>
25
28
37
38#include <mongocxx/cursor.hpp>
45
47
48namespace mongocxx {
49namespace v_noabi {
50
55 private:
57
58 public:
69
73 /* explicit(false) */ client_encryption(v1::client_encryption ce) : _ce{std::move(ce)} {}
74
83 explicit operator v1::client_encryption() && {
84 return std::move(_ce);
85 }
86
90 explicit operator v1::client_encryption() const& = delete;
91
110 create_data_key(std::string kms_provider, v_noabi::options::data_key const& opts = {});
111
128 v_noabi::database const& db,
129 std::string const& coll_name,
130 bsoncxx::v_noabi::document::view const& options,
131 bsoncxx::v_noabi::document::value& out_options,
132 std::string const& kms_provider,
133 bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::view> const& masterkey =
134 bsoncxx::v_noabi::stdx::nullopt);
135
153 encrypt(bsoncxx::v_noabi::types::bson_value::view value, v_noabi::options::encrypt const& opts);
154
166 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::document::value)
167 encrypt_expression(bsoncxx::v_noabi::document::view_or_value expr, v_noabi::options::encrypt const& opts);
168
183 decrypt(bsoncxx::v_noabi::types::bson_value::view value);
184
208 bsoncxx::v_noabi::document::view_or_value filter,
209 v_noabi::options::rewrap_many_datakey const& opts);
210
225 delete_key(bsoncxx::v_noabi::types::bson_value::view_or_value id);
226
239 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::value>)
240 get_key(bsoncxx::v_noabi::types::bson_value::view_or_value id);
241
253
269 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::value>)
271 bsoncxx::v_noabi::types::bson_value::view_or_value id,
272 bsoncxx::v_noabi::string::view_or_value key_alt_name);
273
289 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::value>)
291 bsoncxx::v_noabi::types::bson_value::view_or_value id,
292 bsoncxx::v_noabi::string::view_or_value key_alt_name);
293
306 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::value>)
307 get_key_by_alt_name(bsoncxx::v_noabi::string::view_or_value key_alt_name);
308};
309
310} // namespace v_noabi
311} // namespace mongocxx
312
313#include <mongocxx/config/postlude.hpp>
314
client_encryption(v_noabi::options::client_encryption opts)
Creates a client_encryption object.
Support for MongoDB In-Use Encryption.
Definition client_encryption.hpp:61
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::value create_data_key(std::string kms_provider, v_noabi::options::data_key const &opts={})
Creates a new key document and inserts into the key vault collection.
bsoncxx::v_noabi::document::value encrypt_expression(bsoncxx::v_noabi::document::view_or_value expr, v_noabi::options::encrypt const &opts)
Encrypts a Match Expression or Aggregate Expression to query a range index.
v_noabi::result::rewrap_many_datakey rewrap_many_datakey(bsoncxx::v_noabi::document::view_or_value filter, v_noabi::options::rewrap_many_datakey const &opts)
Decrypts multiple data keys and (re-)encrypts them with a new masterKey, or with their current master...
v_noabi::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...
client_encryption(v_noabi::options::client_encryption opts)
Creates a client_encryption object.
bsoncxx::v_noabi::types::value decrypt(bsoncxx::v_noabi::types::bson_value::view value)
Decrypts an encrypted value (BSON binary of subtype 6).
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).
bsoncxx::v_noabi::types::value encrypt(bsoncxx::v_noabi::types::bson_value::view value, v_noabi::options::encrypt const &opts)
Encrypts a BSON value with a given key and algorithm.
v_noabi::cursor get_keys()
Finds all documents in the key vault collection.
v_noabi::collection create_encrypted_collection(v_noabi::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...
A MongoDB collection.
Definition collection.hpp:98
A cursor over the documents returned by a query to a MongoDB server.
Definition cursor.hpp:50
A MongoDB database.
Definition database.hpp:63
Provides mongocxx::v_noabi::options::data_key.
Provides bsoncxx::v_noabi::document::view_or_value.
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.
Declares entities whose ABI stability is guaranteed for documented symbols.
Declares entities representing options to use with various commands.
Declares entities representing the result of various commands.
Declares entities whose ABI stability is NOT guaranteed.
The top-level namespace within which all mongocxx library entities are declared.
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::string::view_or_value.
Provides bsoncxx::v_noabi::types::bson_value::view_or_value.
Provides mongocxx::v1::client_encryption.
Provides bsoncxx::v_noabi::document::value.
Provides bsoncxx::v_noabi::document::view.
Provides std::optional-related polyfills for library API usage.
Provides bsoncxx::v_noabi::types::bson_value::value.
Provides bsoncxx::v_noabi::types::bson_value::view.
Declares mongocxx::v_noabi::client_encryption.
Declares mongocxx::v_noabi::collection.
Provides mongocxx::v_noabi::cursor.
Declares mongocxx::v_noabi::database.
Provides mongocxx::v_noabi::options::client_encryption.