Loading...
Searching...
No Matches
client_encryption.hpp
Go to the documentation of this file.
// Copyright 2009-present MongoDB, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include <mongocxx/client_encryption-fwd.hpp> // IWYU pragma: export
//
#include <mongocxx/v1/client_encryption.hpp> // IWYU pragma: export
#include <string>
#include <utility>
#include <mongocxx/collection-fwd.hpp>
#include <mongocxx/database-fwd.hpp>
#include <bsoncxx/document/value.hpp>
#include <bsoncxx/document/view.hpp>
#include <bsoncxx/document/view_or_value.hpp>
#include <bsoncxx/stdx/optional.hpp>
#include <bsoncxx/string/view_or_value.hpp>
#include <bsoncxx/types/bson_value/value.hpp>
#include <bsoncxx/types/bson_value/view.hpp>
#include <bsoncxx/types/bson_value/view_or_value.hpp>
#include <mongocxx/cursor.hpp>
#include <mongocxx/options/client_encryption.hpp>
#include <mongocxx/options/data_key.hpp>
#include <mongocxx/options/encrypt.hpp>
#include <mongocxx/options/rewrap_many_datakey.hpp>
#include <mongocxx/result/delete.hpp>
#include <mongocxx/result/rewrap_many_datakey.hpp>
#include <mongocxx/config/prelude.hpp>
namespace mongocxx {
namespace v_noabi {
class client_encryption {
private:
v1::client_encryption _ce;
public:
MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE() client_encryption(v_noabi::options::client_encryption opts);
/* explicit(false) */ client_encryption(v1::client_encryption ce) : _ce{std::move(ce)} {}
explicit operator v1::client_encryption() && {
return std::move(_ce);
}
explicit operator v1::client_encryption() const& = delete;
MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE(bsoncxx::v_noabi::types::value)
create_data_key(std::string kms_provider, v_noabi::options::data_key const& opts = {});
MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE(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);
MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE(bsoncxx::v_noabi::types::value)
encrypt(bsoncxx::v_noabi::types::bson_value::view value, v_noabi::options::encrypt const& opts);
MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE(bsoncxx::v_noabi::document::value)
encrypt_expression(bsoncxx::v_noabi::document::view_or_value expr, v_noabi::options::encrypt const& opts);
MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE(bsoncxx::v_noabi::types::value)
decrypt(bsoncxx::v_noabi::types::bson_value::view value);
MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE(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);
MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE(v_noabi::result::delete_result)
delete_key(bsoncxx::v_noabi::types::bson_value::view_or_value id);
MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE(bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::value>)
get_key(bsoncxx::v_noabi::types::bson_value::view_or_value id);
MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE(v_noabi::cursor) get_keys();
MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE(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);
MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE(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);
MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE(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);
};
inline v_noabi::client_encryption from_v1(v1::client_encryption v) {
return {std::move(v)};
}
inline v1::client_encryption to_v1(v_noabi::client_encryption v) {
return v1::client_encryption{std::move(v)};
}
} // namespace v_noabi
} // namespace mongocxx
#include <mongocxx/config/postlude.hpp>
mongocxx::client_encryption::client_encryption
client_encryption(v_noabi::options::client_encryption opts)
Creates a client_encryption object.
mongocxx::v1::client_encryption
Support for MongoDB In-Use Encryption.
Definition client_encryption.hpp:59
mongocxx::v_noabi::client_encryption
Supports MongoDB Client-Side Field Level Encryption operations.
Definition client_encryption.hpp:54
mongocxx::v_noabi::client_encryption::get_key_by_alt_name
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.
mongocxx::v_noabi::client_encryption::create_data_key
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.
mongocxx::v_noabi::client_encryption::encrypt_expression
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.
mongocxx::v_noabi::client_encryption::rewrap_many_datakey
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...
mongocxx::v_noabi::client_encryption::delete_key
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...
mongocxx::v_noabi::client_encryption::client_encryption
client_encryption(v_noabi::options::client_encryption opts)
Creates a client_encryption object.
mongocxx::v_noabi::client_encryption::decrypt
bsoncxx::v_noabi::types::value decrypt(bsoncxx::v_noabi::types::bson_value::view value)
Decrypts an encrypted value (BSON binary of subtype 6).
mongocxx::v_noabi::client_encryption::add_key_alt_name
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...
mongocxx::v_noabi::client_encryption::remove_key_alt_name
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 ...
mongocxx::v_noabi::client_encryption::get_key
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).
mongocxx::v_noabi::client_encryption::encrypt
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.
mongocxx::v_noabi::client_encryption::get_keys
v_noabi::cursor get_keys()
Finds all documents in the key vault collection.
mongocxx::v_noabi::client_encryption::create_encrypted_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...
mongocxx::v_noabi::collection
A MongoDB collection.
Definition collection.hpp:98
mongocxx::v_noabi::cursor
A cursor over the documents returned by a query to a MongoDB server.
Definition cursor.hpp:50
mongocxx::v_noabi::database
A MongoDB database.
Definition database.hpp:63
data_key.hpp
Provides mongocxx::v_noabi::options::data_key.
view_or_value.hpp
Provides bsoncxx::v_noabi::document::view_or_value.
encrypt.hpp
Provides mongocxx::v_noabi::options::encrypt.
MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE
#define MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE(...)
Equivalent to MONGOCXX_ABI_EXPORT_UNSTABLE with MONGOCXX_ABI_CDECL.
Definition config.hpp:28
postlude.hpp
The mongocxx v_noabi macro guard postlude header.
prelude.hpp
The mongocxx v_noabi macro guard prelude header.
bsoncxx
The top-level namespace within which all bsoncxx library entities are declared.
mongocxx::v1
Declares entities whose ABI stability is guaranteed for documented symbols.
mongocxx::v_noabi::options
Declares entities representing options to use with various commands.
mongocxx::v_noabi::result
Declares entities representing the result of various commands.
mongocxx::v_noabi
Declares entities whose ABI stability is NOT guaranteed.
mongocxx::v_noabi::to_v1
v1::bulk_write to_v1(v_noabi::bulk_write v)
Convert to the mongocxx::v1 equivalent of v.
Definition bulk_write.hpp:162
mongocxx::v_noabi::from_v1
v_noabi::bulk_write from_v1(v1::bulk_write v)
Convert to the mongocxx::v_noabi equivalent of v.
Definition bulk_write.hpp:155
mongocxx
The top-level namespace within which all mongocxx library entities are declared.
rewrap_many_datakey.hpp
Provides mongocxx::v_noabi::options::rewrap_many_datakey.
delete.hpp
Provides mongocxx::v_noabi::result::delete_result.
rewrap_many_datakey.hpp
Provides mongocxx::v_noabi::result::rewrap_many_datakey.
view_or_value.hpp
Provides bsoncxx::v_noabi::string::view_or_value.
view_or_value.hpp
Provides bsoncxx::v_noabi::types::bson_value::view_or_value.
client_encryption.hpp
Provides mongocxx::v1::client_encryption.
value.hpp
Provides bsoncxx::v_noabi::document::value.
view.hpp
Provides bsoncxx::v_noabi::document::view.
optional.hpp
Provides std::optional-related polyfills for library API usage.
value.hpp
Provides bsoncxx::v_noabi::types::bson_value::value.
view.hpp
Provides bsoncxx::v_noabi::types::bson_value::view.
client_encryption-fwd.hpp
Declares mongocxx::v_noabi::client_encryption.
collection-fwd.hpp
Declares mongocxx::v_noabi::collection.
cursor.hpp
Provides mongocxx::v_noabi::cursor.
database-fwd.hpp
Declares mongocxx::v_noabi::database.
client_encryption.hpp
Provides mongocxx::v_noabi::options::client_encryption.