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/v1/client_encryption-fwd.hpp> // IWYU pragma: export
//
#include <mongocxx/v1/detail/prelude.hpp>
#include <bsoncxx/v1/document/value-fwd.hpp>
#include <bsoncxx/v1/document/view-fwd.hpp>
#include <bsoncxx/v1/types/value-fwd.hpp>
#include <mongocxx/v1/client-fwd.hpp>
#include <mongocxx/v1/collection-fwd.hpp>
#include <mongocxx/v1/cursor-fwd.hpp>
#include <mongocxx/v1/data_key_options-fwd.hpp>
#include <mongocxx/v1/database-fwd.hpp>
#include <mongocxx/v1/delete_one_result-fwd.hpp>
#include <mongocxx/v1/encrypt_options-fwd.hpp>
#include <mongocxx/v1/rewrap_many_datakey_options-fwd.hpp>
#include <mongocxx/v1/rewrap_many_datakey_result-fwd.hpp>
#include <bsoncxx/v1/stdx/optional.hpp>
#include <bsoncxx/v1/stdx/string_view.hpp>
#include <mongocxx/v1/config/export.hpp>
#include <string>
#include <utility>
namespace mongocxx {
namespace v1 {
class client_encryption {
private:
void* _impl; // mongoc_client_encryption_t
public:
class options;
MONGOCXX_ABI_EXPORT_CDECL() ~client_encryption();
MONGOCXX_ABI_EXPORT_CDECL() client_encryption(client_encryption&& other) noexcept;
MONGOCXX_ABI_EXPORT_CDECL(client_encryption&) operator=(client_encryption&& other) noexcept;
client_encryption(client_encryption const& other) = delete;
client_encryption& operator=(client_encryption const& other) = delete;
explicit MONGOCXX_ABI_EXPORT_CDECL() client_encryption(options const& opts);
MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::types::value) create_data_key(
bsoncxx::v1::stdx::string_view kms_provider,
v1::data_key_options const& opts);
MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::types::value) create_data_key(bsoncxx::v1::stdx::string_view kms_provider);
MONGOCXX_ABI_EXPORT_CDECL(v1::collection) create_encrypted_collection(
v1::database& db,
bsoncxx::v1::stdx::string_view name,
bsoncxx::v1::document::view opts,
bsoncxx::v1::document::value& coll_opts,
bsoncxx::v1::stdx::string_view kms_provider,
bsoncxx::v1::document::view master_key);
MONGOCXX_ABI_EXPORT_CDECL(v1::collection) create_encrypted_collection(
v1::database& db,
bsoncxx::v1::stdx::string_view name,
bsoncxx::v1::document::view opts,
bsoncxx::v1::document::value& coll_opts,
bsoncxx::v1::stdx::string_view kms_provider);
MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::types::value) encrypt(
bsoncxx::v1::types::value value,
v1::encrypt_options const& opts);
MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::document::value) encrypt_expression(
bsoncxx::v1::document::view expr,
v1::encrypt_options const& opts);
MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::types::value) decrypt(bsoncxx::v1::types::value value);
MONGOCXX_ABI_EXPORT_CDECL(v1::rewrap_many_datakey_result) rewrap_many_datakey(
bsoncxx::v1::document::view filter,
v1::rewrap_many_datakey_options const& opts);
MONGOCXX_ABI_EXPORT_CDECL(v1::delete_one_result) delete_key(bsoncxx::v1::types::value id);
MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::document::value) get_key(bsoncxx::v1::types::value id);
MONGOCXX_ABI_EXPORT_CDECL(v1::cursor) get_keys();
MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::document::value) add_key_alt_name(
bsoncxx::v1::types::value id,
bsoncxx::v1::stdx::string_view key_alt_name);
MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::document::value) remove_key_alt_name(
bsoncxx::v1::types::value id,
bsoncxx::v1::stdx::string_view key_alt_name);
MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::document::value) get_key_by_alt_name(
bsoncxx::v1::stdx::string_view key_alt_name);
class internal;
private:
/* explicit(false) */ client_encryption(void* impl);
};
class client_encryption::options {
private:
class impl;
void* _impl;
public:
MONGOCXX_ABI_EXPORT_CDECL() ~options();
MONGOCXX_ABI_EXPORT_CDECL() options(options&& other) noexcept;
MONGOCXX_ABI_EXPORT_CDECL(options&) operator=(options&& other) noexcept;
MONGOCXX_ABI_EXPORT_CDECL() options(options const& other);
MONGOCXX_ABI_EXPORT_CDECL(options&) operator=(options const& other);
MONGOCXX_ABI_EXPORT_CDECL() options();
MONGOCXX_ABI_EXPORT_CDECL(options&) key_vault_client(v1::client* v);
MONGOCXX_ABI_EXPORT_CDECL(v1::client*) key_vault_client() const;
using ns_pair = std::pair<std::string, std::string>;
MONGOCXX_ABI_EXPORT_CDECL(options&) key_vault_namespace(ns_pair v);
MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<ns_pair>) key_vault_namespace() const;
MONGOCXX_ABI_EXPORT_CDECL(options&) kms_providers(bsoncxx::v1::document::value v);
MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bsoncxx::v1::document::view>) kms_providers() const;
MONGOCXX_ABI_EXPORT_CDECL(options&) tls_opts(bsoncxx::v1::document::value v);
MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bsoncxx::v1::document::view>) tls_opts() const;
class internal;
};
} // namespace v1
} // namespace mongocxx
#include <mongocxx/v1/detail/postlude.hpp>
mongocxx::v1::client_encryption::options
Options for mongocxx::v1::client_encryption.
Definition client_encryption.hpp:288
mongocxx::v1::client_encryption::options::key_vault_namespace
options & key_vault_namespace(ns_pair v)
Set the "keyVaultNamespace" field.
mongocxx::v1::client_encryption::options::tls_opts
options & tls_opts(bsoncxx::v1::document::value v)
Set the "tlsOptions" field.
mongocxx::v1::client_encryption::options::key_vault_client
options & key_vault_client(v1::client *v)
Set the "keyVaultClient" field.
mongocxx::v1::client_encryption::options::kms_providers
options & kms_providers(bsoncxx::v1::document::value v)
Set the "kmsProviders" field.
mongocxx::v1::client_encryption::options::options
options(options &&other) noexcept
Move constructor.
mongocxx::v1::client_encryption::options::~options
~options()
Destroy this object.
mongocxx::v1::client_encryption::options::ns_pair
std::pair< std::string, std::string > ns_pair
The name of a database and a collection.
Definition client_encryption.hpp:356
mongocxx::v1::client_encryption::get_key_by_alt_name
bsoncxx::v1::document::value get_key_by_alt_name(bsoncxx::v1::stdx::string_view key_alt_name)
Return the specified data key.
mongocxx::v1::client_encryption::create_data_key
bsoncxx::v1::types::value create_data_key(bsoncxx::v1::stdx::string_view kms_provider, v1::data_key_options const &opts)
Create a new data key within the key vault collection.
mongocxx::v1::client_encryption::encrypt
bsoncxx::v1::types::value encrypt(bsoncxx::v1::types::value value, v1::encrypt_options const &opts)
Encrypt the given value.
mongocxx::v1::client_encryption::client_encryption
client_encryption(client_encryption &&other) noexcept
Move constructor.
mongocxx::v1::client_encryption::remove_key_alt_name
bsoncxx::v1::document::value remove_key_alt_name(bsoncxx::v1::types::value id, bsoncxx::v1::stdx::string_view key_alt_name)
Remove the given keyAltName from the specified data key.
mongocxx::v1::client_encryption::encrypt_expression
bsoncxx::v1::document::value encrypt_expression(bsoncxx::v1::document::view expr, v1::encrypt_options const &opts)
Encrypt the given Match Expression or Aggregate Expression.
mongocxx::v1::client_encryption::get_keys
v1::cursor get_keys()
Return all data keys within the associated key vault collection.
mongocxx::v1::client_encryption::~client_encryption
~client_encryption()
Destroy this object.
mongocxx::v1::client_encryption::rewrap_many_datakey
v1::rewrap_many_datakey_result rewrap_many_datakey(bsoncxx::v1::document::view filter, v1::rewrap_many_datakey_options const &opts)
Decrypt and (re-)encrypt multiple data keys.
mongocxx::v1::client_encryption::create_encrypted_collection
v1::collection create_encrypted_collection(v1::database &db, bsoncxx::v1::stdx::string_view name, bsoncxx::v1::document::view opts, bsoncxx::v1::document::value &coll_opts, bsoncxx::v1::stdx::string_view kms_provider, bsoncxx::v1::document::view master_key)
Create a collection with encrypted fields.
mongocxx::v1::client_encryption::decrypt
bsoncxx::v1::types::value decrypt(bsoncxx::v1::types::value value)
Decrypt the given value.
mongocxx::v1::client_encryption::delete_key
v1::delete_one_result delete_key(bsoncxx::v1::types::value id)
Delete the specified data key.
mongocxx::v1::client_encryption::add_key_alt_name
bsoncxx::v1::document::value add_key_alt_name(bsoncxx::v1::types::value id, bsoncxx::v1::stdx::string_view key_alt_name)
Add a new keyAltName to the specified data key.
mongocxx::v1::client_encryption::get_key
bsoncxx::v1::document::value get_key(bsoncxx::v1::types::value id)
Return the requested data key.
mongocxx::v1::client
A connection to a MongoDB deployment.
Definition client.hpp:60
mongocxx::v1::collection
A MongoDB collection.
Definition collection.hpp:81
mongocxx::v1::cursor
A MongoDB cursor.
Definition cursor.hpp:39
mongocxx::v1::data_key_options
A Data Encryption Key (DEK) for In-Use Encryption.
Definition data_key_options.hpp:48
mongocxx::v1::database
A MongoDB database.
Definition database.hpp:55
mongocxx::v1::delete_one_result
The result of a "deleteOne" operation.
Definition delete_one_result.hpp:40
mongocxx::v1::encrypt_options
Options related to explicit encryption for In-Use Encryption.
Definition encrypt_options.hpp:57
mongocxx::v1::rewrap_many_datakey_options
Options for a "rewrapManyDataKey" operation.
Definition rewrap_many_datakey_options.hpp:46
mongocxx::v1::rewrap_many_datakey_result
The result of a "rewrapManyDataKey" operation.
Definition rewrap_many_datakey_result.hpp:40
data_key_options-fwd.hpp
Declares mongocxx::v1::data_key_options.
delete_one_result-fwd.hpp
Declares mongocxx::v1::delete_one_result.
encrypt_options-fwd.hpp
Declares mongocxx::v1::encrypt_options.
export.hpp
Provides macros to control the set of symbols exported in the ABI.
MONGOCXX_ABI_EXPORT_CDECL
#define MONGOCXX_ABI_EXPORT_CDECL(...)
Equivalent to MONGOCXX_ABI_EXPORT with MONGOCXX_ABI_CDECL.
Definition export.hpp:52
prelude.hpp
The mongocxx v1 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
The top-level namespace within which all mongocxx library entities are declared.
rewrap_many_datakey_options-fwd.hpp
Declares mongocxx::v1::rewrap_many_datakey_options.
rewrap_many_datakey_result-fwd.hpp
Declares mongocxx::v1::rewrap_many_datakey_result.
client-fwd.hpp
Declares mongocxx::v1::client.
client_encryption-fwd.hpp
Declares mongocxx::v1::client_encryption.
collection-fwd.hpp
Declares mongocxx::v1::collection.
cursor-fwd.hpp
Declares mongocxx::v1::cursor.
database-fwd.hpp
Declares mongocxx::v1::database.
value-fwd.hpp
Declares bsoncxx::v1::document::value.
view-fwd.hpp
Declares bsoncxx::v1::document::view.
optional.hpp
Provides std::optional-related polyfills for library API usage.
string_view.hpp
Provides std::string_view-related polyfills for library API usage.
value-fwd.hpp
Declares bsoncxx::v1::types::value.