MongoDB C++ Driver mongocxx-3.10.1
Loading...
Searching...
No Matches
encrypt.hpp
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// 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>
18#include <mongocxx/options/encrypt-fwd.hpp>
19
20#include <bsoncxx/stdx/optional.hpp>
21#include <bsoncxx/types.hpp>
22#include <bsoncxx/types/bson_value/view_or_value.hpp>
23#include <mongocxx/options/range.hpp>
24#include <mongocxx/stdx.hpp>
25
26#include <mongocxx/config/prelude.hpp>
27
28namespace mongocxx {
29namespace v_noabi {
30namespace options {
31
35class encrypt {
36 public:
54
61 const stdx::optional<bsoncxx::v_noabi::types::bson_value::view_or_value>& key_id() const;
62
75 encrypt& key_alt_name(std::string name);
76
83 const stdx::optional<std::string>& key_alt_name() const;
84
89 enum class encryption_algorithm : std::uint8_t {
94
99
103 k_indexed,
104
109
117 };
118
123 enum class encryption_query_type : std::uint8_t {
126
131 };
132
150
159 const stdx::optional<encryption_algorithm>& algorithm() const;
160
170
177 const stdx::optional<int64_t>& contention_factor() const;
178
188
195 const stdx::optional<encryption_query_type>& query_type() const;
196
206
218 const stdx::optional<options::range>& range_opts() const;
219
220 private:
221 friend ::mongocxx::v_noabi::client_encryption;
222
223 MONGOCXX_PRIVATE void* convert() const;
224
225 stdx::optional<bsoncxx::v_noabi::types::bson_value::view_or_value> _key_id;
226 stdx::optional<std::string> _key_alt_name;
227 stdx::optional<encryption_algorithm> _algorithm;
228 stdx::optional<int64_t> _contention_factor;
229 stdx::optional<encryption_query_type> _query_type;
230 stdx::optional<options::range> _range_opts;
231};
232
233} // namespace options
234} // namespace v_noabi
235} // namespace mongocxx
236
237#include <mongocxx/config/postlude.hpp>
Class representing options for explicit client-side encryption.
Definition encrypt.hpp:35
encrypt & key_id(bsoncxx::v_noabi::types::bson_value::view_or_value key_id)
Sets the key to use for this encryption operation.
const stdx::optional< encryption_algorithm > & algorithm() const
Gets the current algorithm.
const stdx::optional< std::string > & key_alt_name() const
Gets the current key alt name.
const stdx::optional< bsoncxx::v_noabi::types::bson_value::view_or_value > & key_id() const
Gets the key_id.
encrypt & algorithm(encryption_algorithm algorithm)
Sets the algorithm to use for encryption.
encrypt & key_alt_name(std::string name)
Sets a name by which to lookup a key from the key vault collection to use for this encryption operati...
encrypt & query_type(encryption_query_type query_type)
Sets the query type to use for encryption.
const stdx::optional< encryption_query_type > & query_type() const
Gets the current query type.
encryption_query_type
queryType only applies when algorithm is "indexed" or "rangePreview".
Definition encrypt.hpp:123
encrypt & contention_factor(int64_t contention_factor)
Sets the contention factor to use for encryption.
encrypt & range_opts(options::range opts)
Sets the range options to use for encryption.
const stdx::optional< int64_t > & contention_factor() const
Gets the current contention factor.
encryption_algorithm
Determines which AEAD_AES_256_CBC algorithm to use with HMAC_SHA_512 when encrypting data.
Definition encrypt.hpp:89
const stdx::optional< options::range > & range_opts() const
Gets the current range options.
RangeOpts specifies index options for a Queryable Encryption field supporting "rangePreview" queries.
Definition range.hpp:43
The top-level namespace for mongocxx library entities.
Definition bulk_write-fwd.hpp:19