MongoDB C++ Driver  mongocxx-3.10.2
1 // Copyright 2020 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 //
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.
15 #pragma once
17 #include <mongocxx/client_encryption-fwd.hpp>
18 #include <mongocxx/collection-fwd.hpp>
19 #include <mongocxx/database-fwd.hpp>
21 #include <bsoncxx/types/bson_value/value.hpp>
22 #include <bsoncxx/types/bson_value/view.hpp>
23 #include <mongocxx/cursor.hpp>
24 #include <mongocxx/options/client_encryption.hpp>
25 #include <mongocxx/options/data_key.hpp>
26 #include <mongocxx/options/encrypt.hpp>
27 #include <mongocxx/options/rewrap_many_datakey.hpp>
28 #include <mongocxx/result/delete.hpp>
29 #include <mongocxx/result/rewrap_many_datakey.hpp>
30 #include <mongocxx/stdx.hpp>
32 #include <mongocxx/config/prelude.hpp>
34 namespace mongocxx {
35 namespace v_noabi {
41  public:
56  ~client_encryption() noexcept;
68  client_encryption(const client_encryption&) = delete;
69  client_encryption& operator=(const client_encryption&) = delete;
88  bsoncxx::v_noabi::types::bson_value::value create_data_key(std::string kms_provider,
89  const options::data_key& opts = {});
106  const database& db,
107  const std::string& coll_name,
108  const bsoncxx::v_noabi::document::view& options,
110  const std::string& kms_provider,
111  const stdx::optional<bsoncxx::v_noabi::document::view>& masterkey = stdx::nullopt);
213  stdx::optional<bsoncxx::v_noabi::document::value> get_key(
241  stdx::optional<bsoncxx::v_noabi::document::value> add_key_alt_name(
259  stdx::optional<bsoncxx::v_noabi::document::value> remove_key_alt_name(
274  stdx::optional<bsoncxx::v_noabi::document::value> get_key_by_alt_name(
277  private:
278  class MONGOCXX_PRIVATE impl;
280  std::unique_ptr<impl> _impl;
281 };
283 } // namespace v_noabi
284 } // namespace mongocxx
286 #include <mongocxx/config/postlude.hpp>
A read-only BSON document that owns its underlying buffer.
Definition: value.hpp:38
A read-only, non-owning view of a BSON document.
Definition: view.hpp:35
Class representing a view-or-value variant type for strings.
Definition: view_or_value.hpp:38
A variant owning type that represents any BSON type.
Definition: value.hpp:46
A view-only variant that can contain any BSON type.
Definition: view.hpp:41
Class supporting operations for MongoDB Client-Side Field Level Encryption.
Definition: client_encryption.hpp:40
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 > 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 ...
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.
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.
client_encryption(options::client_encryption opts)
Creates a client_encryption object.
~client_encryption() noexcept
Destroys a client_encryption.
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:86
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:46
Class representing options for the object managing explicit client-side encryption.
Definition: client_encryption.hpp:36
Class representing options for explicit client-side encryption.
Definition: encrypt.hpp:35
Class representing options for a rewrap many datakey operation.
Definition: rewrap_many_datakey.hpp:35
Class representing the result of a MongoDB delete operation.
Definition: delete.hpp:32
Class representing the result of a MongoDB rewrap_many_datakey operation.
Definition: rewrap_many_datakey.hpp:30
The top-level namespace for bsoncxx library entities.
Definition: element-fwd.hpp:19
The top-level namespace for mongocxx library entities.
Definition: bulk_write-fwd.hpp:19