类:Mongo::Crypt::Binding Private
Overview
此类是私有 API 的一部分。 应尽可能避免使用此类,因为它将来可能会被删除或更改。
libmongocrypt C库的Ruby绑定
常量摘要折叠
- MIN_LIBMONGOCRYPT_VERSION =
此常量是私有 API 的一部分。 应尽可能避免使用此常量,因为它将来可能会被删除或更改。
此版本的驱动程序所需的最低 libmongocrypt 版本。尝试将驱动程序与任何以前版本的 libmongocrypt 一起使用将导致
LoadError。 Gem::版本.new(' 1.12.0 ')
类方法摘要折叠
-
。 check_ctx_status (context) ⇒ nil
private
根据底层 mongocrypt_ctx_t 对象的状态引发 Mongo::Error::CryptError。
-
。 check_kms_ctx_status (kms_context) ⇒ 对象
private
如果提供的区块返回 false,则使用所提供的 KmsContext 对象中的状态信息引发 CryptError。
-
。 check_status (handle) ⇒ nil
private
根据根本的mongocrypt_t对象的状态引发 Mongo::Error::CryptError 。
-
。 crypt_shared_lib_version (处理) ⇒ 整数
private
获取64位常量,对已加载的 crypt_shared 库的版本进行编码(如果可用)。
-
。 ctx_datakey_init (context) ⇒ 对象
private
初始化上下文以创建数据密钥。
-
。 ctx_decrypt_init (context, command) ⇒ 对象
private
初始化自动解密的上下文。
-
。 ctx_encrypt_init (context, db_name, command) ⇒ 对象
private
初始化自动加密的上下文。
-
.ctx_explicit_decrypt_init(context, doc) ⇒ Object
private
为显式解密初始化上下文。
-
.ctx_explicit_encrypt_expression_init(context, doc) ⇒ Object
private
初始化显式表达式加密的上下文。
-
.ctx_explicit_encrypt_init(context, doc) ⇒ Object
private
初始化显式加密的上下文。
-
。 ctx_finalize (context) ⇒ 对象
private
完成上下文表示的状态机。
-
.ctx_kms_done(context) ⇒ Object
private
向 libmongocrypt 表明它将不再收到KMS回复。
-
。 ctx_mongo_feed (context, doc) ⇒ 对象
private
将驱动程序的响应反馈给 libmongocrypt。
-
.ctx_mongo_op(context) ⇒ BSON::Document
private
返回一个BSON::文档,表示驱动程序必须代表 libmongocrypt 执行以获取所需信息以继续加密/解密的操作(示例,用于密钥保管库查询的过滤器)。
-
。 ctx_next_kms_ctx (context) ⇒ Mongo::Crypt::KmsContext | ctx_next_kms_ctx nil
private
返回 Context对象所需的新 KmsContext对象。
-
。 ctx_provide_kms_providers (context, kms_providers) ⇒ 对象
private
为响应 MONGOCRYPT_CTX_NEED_KMS_CREDENTIALS 状态而调用,以设置每个上下文的 KMS 提供程序设置。
-
。 ctx_rewrap_many_datakey_init (context, filter) ⇒ Boolean
private
初始化上下文以重新包装数据键。
-
。 ctx_setopt_algorithm (context, name) ⇒ 对象
private
根据上下文设置算法。
-
。 ctx_setopt_algorithm_range (context, opts) ⇒ 对象
private
设置使用“范围”算法进行显式加密的选项。
-
。 ctx_setopt_contention_factor (context,factor) ⇒ 对象
private
设置用于显式加密的争用因子。
-
。 ctx_setopt_key_alt_names (context, key_alt_names) ⇒ 对象
private
在创建数据密钥时设置多个备用密钥名称。
-
。 ctx_setopt_key_encryption_key (context, key_document) ⇒ 对象
private
设置用于创建数据密钥的密钥加密密钥文档。
-
.ctx_setopt_key_id(context, key_id) ⇒ Object
private
在显式加密上下文中设置密钥 ID 选项。
-
。 ctx_setopt_key_material (context, key_material) ⇒ 对象
private
设置用于加密数据的自定义密钥材料。
-
。 ctx_setopt_query_type (context, query_type) ⇒ 对象
private
设置用于 FLE 2显式加密的查询类型。
- 。 get_binary_data_direct (mongocrypt_binary_t) ⇒ 对象 private
- 。 get_binary_len_direct (mongocrypt_binary_t) ⇒ 对象 private
-
。 init (处理) ⇒ 对象
private
初始化 Mongo::Crypt::Handle 对象。
-
。 kms_ctx_bytes_needed (kms_context) ⇒ 整数
private
获取 KmsContext 所需的字节数。
-
.kms_ctx_endpoint(kms_context) ⇒ String | nil
private
获取通过 TLS 连接的主机名,以获取有关Amazon Web Services主密钥的信息。
-
。 kms_ctx_fail (kms_context) ⇒ true, false
private
检查是否可以重试上次失败的KMS上下文请求。
-
。 kms_ctx_feed (kms_context, bytes) ⇒ 对象
private
将KMS的回复反馈回 libmongocrypt。
-
。 kms_ctx_get_kms_provider (kms_context) ⇒ 对象
private
获取与此KMS请求关联的KMS提供商标识符。
-
.kms_ctx_message(kms_context) ⇒ String
private
HTTP获取从Amazon Web ServicesKMS KmsContext对象获取 主密钥所需的 消息。
-
.kms_ctx_setopt_retry_kms(handle, value) ⇒ true, fale
private
启用或禁用KMS重试行为。
-
.kms_ctx_usleep(kms_context) ⇒ Integer
private
返回在为给定KMS上下文发送KMS请求之前处于休眠状态的毫秒数。
-
。 mongocrypt_binary_data (binary) ⇒ FFI::Pointer
private
获取指向 mongocrypt_binary_t根本的数据的指针。
-
。 mongocrypt_binary_destroy (binary) ⇒ nil
private
销毁 mongocrypt_binary_t对象。
-
。 mongocrypt_binary_len (binary) ⇒ 整数
private
获取基础数据数组的长度。
-
。 mongocrypt_binary_new ⇒ FFI::Pointer
private
创建新的 mongocrypt_binary_t 对象(字节数组的非拥有视图)。
-
。 mongocrypt_binary_new_from_data (data, len) ⇒ FFI::Pointer
private
创建一个新的 mongocrypt_binary_t 对象,用于维护指向指定字节数组的指针。
- 。 mongocrypt_crypt_shared_lib_version (crypt) ⇒ 对象 private
- 。 mongocrypt_ctx_datakey_init (ctx, 过滤) ⇒ 对象 private
-
.mongocrypt_ctx_decrypt_init(ctx, doc) ⇒ Boolean
private
初始化 ctx 以进行自动解密。
-
。 mongocrypt_ctx_destroy (ctx) ⇒ nil
private
销毁对 mongocrypt_ctx_t对象的引用。
-
。 mongocrypt_ctx_encrypt_init (ctx, db, db_len, cmd) ⇒ 布尔值
private
初始化 ctx 以进行自动加密。
-
.mongocrypt_ctx_explicit_decrypt_init(ctx, msg) ⇒ Boolean
private
为显式解密初始化 ctx。
-
.mongocrypt_ctx_explicit_encrypt_init(ctx, msg) ⇒ Boolean
private
为显式表达式加密初始化 ctx。
-
。 mongocrypt_ctx_finalize (ctx, op_bson) ⇒ 布尔值
private
执行最终的加密或解密,并返回BSON文档。
-
.mongocrypt_ctx_mongo_done(ctx) ⇒ Boolean
private
指示 libmongocrypt 驱动程序已完成提供回复。
-
。 mongocrypt_ctx_mongo_feed (ctx,reply) ⇒ 布尔值
private
将BSON回复发送给 libmongocrypt。
-
。 mongocrypt_ctx_mongo_next_kms_ctx (ctx) ⇒ FFI::Pointer
private
返回指向 mongocrypt_kms_ctx_t对象的指针或 NULL。
-
。 mongocrypt_ctx_mongo_op (ctx, op_bson) ⇒ 布尔值
private
获取驱动程序的BSON操作,以针对MongoDB集合、密钥保管库数据库或 mongocryptd运行。
-
。 mongocrypt_ctx_new (crypt) ⇒ FFI::Pointer
private
创建一个新的 mongocrypt_ctx_t对象(libmongocrypt 状态机的包装器)。
- 。 mongocrypt_ctx_provide_kms_providers (ctx, kms_providers) ⇒ 对象 private
-
。 mongocrypt_ctx_setopt_algorithm (ctx, 算法, len) ⇒ Boolean
private
设置用于显式加密的算法。
- 。 mongocrypt_ctx_setopt_algorithm_range (ctx, opts) ⇒ 对象 private
- 。 mongocrypt_ctx_setopt_contention_factor (ctx,contention_factor) ⇒ 对象 private
-
。 mongocrypt_ctx_setopt_key_alt_name (ctx, binary) ⇒ Boolean
private
创建数据密钥时,请为该密钥设立备用名称。
-
。 mongocrypt_ctx_setopt_key_encryption_key (ctx) ⇒ 布尔值
private
设置用于创建数据密钥的密钥加密密钥文档。
-
.mongocrypt_ctx_setopt_key_id(ctx, key_id) ⇒ Boolean
private
设置用于显式加密的密钥 ID。
-
。 mongocrypt_ctx_setopt_key_material (ctx, binary) ⇒ Boolean
private
创建数据密钥时,请设立用于加密数据的自定义密钥材料。
- 。 mongocrypt_ctx_setopt_query_type (ctx, mongocrypt_query_type) ⇒ 对象 private
-
。 mongocrypt_ctx_state (ctx) ⇒ 符号
private
获取 ctx 的当前状态。
-
。 mongocrypt_ctx_status (ctx, status) ⇒ Boolean
private
在 mongocrypt_status_t对象上设置来自 mongocrypt_ctx_t对象的状态信息。
-
。 mongocrypt_destroy (crypt) ⇒ nil
private
销毁对 mongocrypt_t 对象的引用。
-
。 mongocrypt_init (crypt) ⇒ 布尔值
private
初始化 mongocrypt_t对象。
-
。 mongocrypt_kms_ctx_bytes_needed ( KMS ) ⇒ 整数
private
获取KMS上下文所需的字节数。
-
.mongocrypt_kms_ctx_done(ctx) ⇒ Boolean
private
指示 libmongocrypt,它将不再收到来自 mongocrypt_kms_ctx_t 对象的回复。
-
。 mongocrypt_kms_ctx_endpoint ( KMS , endpoint) ⇒ Boolean
private
获取通过 TLS 连接的主机名,以获取有关Amazon Web Services主密钥的信息。
- .mongocrypt_kms_ctx_fail(ctx) ⇒ Object private
-
。 mongocrypt_kms_ctx_feed ( KMS , bytes) ⇒ 布尔值
private
将KMS的回复反馈回 libmongocrypt。
- 。 mongocrypt_kms_ctx_get_kms_provider (crypt, kms_providers) ⇒ 对象 private
-
。 mongocrypt_kms_ctx_message ( KMS , msg) ⇒ 布尔值
private
获取获取Amazon Web Services KMS主密钥所需的消息。
-
。 mongocrypt_kms_ctx_status ( KMS , status) ⇒ 布尔值
private
将有关 mongocrypt_kms_ctx_t 对象的状态信息写入 mongocrypt_status_t 对象。
-
.mongocrypt_kms_ctx_usleep(ctx) ⇒ int64
private
指示发送KMS请求之前的休眠时间。
-
。 mongocrypt_setopt_aes_ 256 _ctr (crypt, aes_ 256 _ctr_encrypt, aes_ 256 _ctr_decrypt, ctx) ⇒ 布尔值
private
为 AES 256 -CTR 操作设置加密钩子。
- 。 mongocrypt_setopt_append_crypt_shared_lib_search_path (crypt, path) ⇒ 对象 private
- 。 mongocrypt_setopt_bypass_query_analysis (crypt) ⇒ 对象 private
-
。 mongocrypt_setopt_crypto_hook_sign_rsaes_pkcs 1 _v 1 _ 5 (crypt, sign_rsaes_pkcs 1 _v 1 _ 5 , ctx = nil) ⇒ 布尔值
private
使用 SHA- 256哈希为 RSASSA-PKCS 1 -v 1 _ 5算法设置加密钩子。
-
。 mongocrypt_setopt_crypto_hooks (crypt, aes_enc_fn, aes_dec_fn, random_fn, sha_ 512 _fn, sha_ 256 _fn, hash_fn, ctx = nil) ="
private
在提供的 mongocrypt对象上设置加密钩子。
- 。 mongocrypt_setopt_encrypted_field_config_map (crypt, efc_map) ⇒ 对象 private
-
。 mongocrypt_setopt_kms_providers (crypt, kms_providers) ⇒ 对象
private
使用BSON文档配置KMS提供商。
-
。 mongocrypt_setopt_log_handler (crypt, log_fn, log_ctx = nil) ⇒ Boolean
private
将 mongocrypt_t 对象上的处理程序设置为在每次 libmongocrypt 记录消息时调用。
- 。 mongocrypt_setopt_retry_kms (crypt, 启用) ⇒ 对象 private
-
。 mongocrypt_setopt_schema_map (crypt, schema_map) ⇒ 布尔值
private
设置用于加密的本地模式映射。
- 。 mongocrypt_setopt_set_crypt_shared_lib_path_override (crypt, path) ⇒ 对象 private
- 。 mongocrypt_setopt_use_need_kms_credentials_state (crypt) ⇒ 对象 private
-
。 mongocrypt_status (crypt, status) ⇒ Boolean
private
在 mongocrypt_status_t对象上设置 mongocrypt_t对象的状态信息。
-
。 mongocrypt_status_code (status) ⇒ 整数
private
返回状态错误代码。
-
。 mongocrypt_status_destroy (status) ⇒ nil
private
销毁对 mongocrypt_status_t 对象的引用。
-
.mongocrypt_status_message(status, len = nil) ⇒ String
private
返回状态消息。
-
。 mongocrypt_status_new ⇒ FFI::Pointer
private
创建新的 mongocrypt_status_t 对象。
-
。 mongocrypt_status_ok (status) ⇒ 布尔值
private
返回状态是正常还是错误。
-
。 mongocrypt_status_set (status, type, code, message, len) ⇒ nil
private
在现有状态上设置消息、类型和代码。
-
.mongocrypt_status_type(status) ⇒ Symbol
private
指示状态类型。
-
。 mongocrypt_version (len) ⇒ string
private
返回 libmongocrypt 库的版本string 。
-
。 ongocrypt_new ⇒ FFI::Pointer
private
创建新的 mongocrypt_t对象。
-
.parse_version(version) ⇒ Gem::Version
private
给定一个表示版本号的string ,将其解析为一个 Gem::Version 对象。
-
。 setopt_aes_ 256 _ctr (处理, aes_ctr_encrypt_cb, aes_ctr_decrypt_cb) ⇒ 对象
private
为 AES 256 -CTR 操作设置加密钩子。
-
。 setopt_append_crypt_shared_lib_search_path (处理, path) ⇒ 对象
private
在搜索路径中追加一个搜索目录,用于加载 crypt_shared 动态库。
-
。 setopt_bypass_query_analysis (处理) ⇒ 对象
private
选择跳过查询分析。
-
。 setopt_crypto_hook_sign_rsaes_pkcs 1 _v 1 _ 5 (处理, rsaes_pkcs_signature_cb) ⇒ 对象
private
使用 SHA- 256哈希值或句柄为 RSASSA-PKCS 1 -v 1 _ 5算法设置加密钩子。
-
。 setopt_crypto_hooks (处理, aes_encrypt_cb, aes_decrypt_cb, random_cb, hmac_sha_ 512 _cb, hmac_sha_ 256 _cb, hmac_hash_cb) ⇒ 对象
private
在句柄上设置加密回调。
-
。 setopt_encrypted_field_config_map (处理, efc_map) ⇒ 对象
private
设置用于加密的本地 EncryptedFieldConfigMap。
-
。 setopt_kms_providers (处理, kms_providers) ⇒ 对象
private
在 Mongo::Crypt::Handle对象上设置KMS提供程序选项。
-
。 setopt_log_handler (handle, log_callback) ⇒ 对象
private
在 Mongo::Crypt::Handle 对象上设置记录器回调函数。
-
。 setopt_schema_map (处理, schema_map_doc) ⇒ 对象
private
在 Mongo::Crypt::Handle对象上设置模式映射。
-
。 setopt_set_crypt_shared_lib_path_override (处理, path) ⇒ 对象
private
设置用于加载 crypt 共享库的单个覆盖路径。
-
。 setopt_use_need_kms_credentials_state (处理) ⇒ 对象
private
选择处理 MONGOCRYPT_CTX_NEED_KMS_CREDENTIALS 状态。
-
.validate_document(data) ⇒ Object
private
在将指定数据序列化为 BSON 之前检查其是否为哈希,以防止 libmongocrypt 出错。
-
.validate_version(lmc_version) ⇒ Object
private
验证提供的 libmongocrypt 版本是否有效,即
实例方法摘要折叠
-
# mongocrypt_crypto_fn (ctx, key, iv, input, output, status) ⇒ Bool
private
对执行 AES加密或解密的函数的回调。
-
#mongocrypt_hash_fn(ctx, input, output, status) ⇒ Bool
private
对 SHA- 256哈希函数的回调。
-
# mongocrypt_hmac_fn (ctx, key, input, output, status) ⇒ Bool
private
对执行 HMAC SHA- 512或 SHA- 256的函数的回调。
-
# mongocrypt_log_fn_t (level, message, len, ctx) ⇒ nil
private
对 mongocrypt日志函数的回调。
-
# mongocrypt_random_fn (ctx, output, count, status) ⇒ Bool
private
对加密安全随机函数的回调。
类方法详细信息
.check_ctx_status(context) ⇒ nil
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
根据底层 mongocrypt_ctx_t 对象的状态引发 Mongo::Error::CryptError。
1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1815 def self.check_ctx_status(上下文) do_rise = if block_given? !产量 else true end return 除非 do_rise 状态 = 状态.new mongocrypt_ctx_status(上下文.ctx_p, 状态.ref) 状态.Raise_crypt_error end |
。 check_kms_ctx_status (kms_context) ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
如果提供的区块返回 false,则使用所提供的 KmsContext 对象中的状态信息引发 CryptError。
1105 1106 1107 1108 1109 1110 1111 1112 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1105 def self.check_kms_ctx_status(kms_context) return if 产量 状态 = 状态.new mongocrypt_kms_ctx_status(kms_context.kms_ctx_p, 状态.ref) 状态.Raise_crypt_error(KMS : true) end |
。 check_status (处理) ⇒ nil
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
根据根本的mongocrypt_t对象的状态引发 Mongo::Error::CryptError 。
1802 1803 1804 1805 1806 1807 1808 1809 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1802 def self.check_status(处理) return if 产量 状态 = 状态.new mongocrypt_status(处理.ref, 状态.ref) 状态.Raise_crypt_error end |
。 crypt_shared_lib_version (处理) ⇒整数
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
获取64位常量,对已加载的 crypt_shared 库的版本进行编码(如果可用)。
版本从高到低编码为四个16位数字:
- 主要版本
- 次要版本
- 修订版
- reserved
示例,版本 6.2.1 将编码为:0x0006'0002'0001'0000
1608 1609 1610 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1608 def self.crypt_shared_lib_version(处理) mongocrypt_crypt_shared_lib_version(处理.ref) end |
。 ctx_datakey_init (context) ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
初始化上下文以创建数据密钥
623 624 625 626 627 |
# File 'lib/ Mongo/crypt/bounding.rb', line 623 def self.ctx_datakey_init(上下文) check_ctx_status(上下文) do mongocrypt_ctx_datakey_init(上下文.ctx_p) end end |
。 ctx_decrypt_init (context, command) ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
初始化自动解密的上下文
784 785 786 787 788 789 790 791 792 |
# File 'lib/ Mongo/crypt/bounding.rb', line 784 def self.ctx_decrypt_init(上下文, 命令) validate_document(命令) 数据 = 命令.to_bson.to_s 二进制文件.wrapp_string(数据) do |data_p| check_ctx_status(上下文) do mongocrypt_ctx_decrypt_init(上下文.ctx_p, data_p) end end end |
。 ctx_encrypt_init (context, db_name, command) ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
初始化自动加密的上下文
690 691 692 693 694 695 696 697 698 |
# File 'lib/ Mongo/crypt/bounding.rb', line 690 def self.ctx_encrypt_init(上下文, db_name, 命令) validate_document(命令) 数据 = 命令.to_bson.to_s 二进制文件.wrapp_string(数据) do |data_p| check_ctx_status(上下文) do mongocrypt_ctx_encrypt_init(上下文.ctx_p, db_name, -1, data_p) end end end |
.ctx_explicit_decrypt_init(context, doc) ⇒ Object
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
为显式解密初始化上下文
814 815 816 817 818 819 820 821 822 |
# File 'lib/ Mongo/crypt/bounding.rb', line 814 def self.ctx_explicit_decrypt_init(上下文, doc) validate_document(doc) 数据 = doc.to_bson.to_s 二进制文件.wrapp_string(数据) do |data_p| check_ctx_status(上下文) do mongocrypt_ctx_explicit_decrypt_init(上下文.ctx_p, data_p) end end end |
。 ctx_explicit_encrypt_expression_init (context, doc) ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
初始化显式表达式加密的上下文。
758 759 760 761 762 763 764 765 766 |
# File 'lib/ Mongo/crypt/bounding.rb', line 758 def self.ctx_explicit_encrypt_expression_init(上下文, doc) validate_document(doc) 数据 = doc.to_bson.to_s 二进制文件.wrapp_string(数据) do |data_p| check_ctx_status(上下文) do mongocrypt_ctx_explicit_encrypt_expression_init(上下文.ctx_p, data_p) end end end |
.ctx_explicit_encrypt_init(context, doc) ⇒ Object
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
初始化显式加密的上下文
724 725 726 727 728 729 730 731 732 |
# File 'lib/ Mongo/crypt/bounding.rb', line 724 def self.ctx_explicit_encrypt_init(上下文, doc) validate_document(doc) 数据 = doc.to_bson.to_s 二进制文件.wrapp_string(数据) do |data_p| check_ctx_status(上下文) do mongocrypt_ctx_explicit_encrypt_init(上下文.ctx_p, data_p) end end end |
。 ctx_finalize (context) ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
最终确定 Context 表示的状态机
1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1206 def self.ctx_finalize(上下文) 二进制文件 = 二进制文件.new check_ctx_status(上下文) do mongocrypt_ctx_finalize(上下文.ctx_p, 二进制文件.ref) end # TODO:由于二进制文件引用了C指针,而 ByteBuffer 是 # 在 MRI 中用 C 语言编写,我们可以省略数据副本,方法是 # ByteBuffer 引用 libmongocrypt 拥有的string 。 BSON::文档.from_bson(BSON::ByteBuffer.new(二进制文件.to_s), 模式: 上下文.bson_mode) end |
.ctx_kms_done(context) ⇒ Object
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
向 libmongocrypt 表明它将不再收到KMS回复。
1183 1184 1185 1186 1187 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1183 def self.ctx_kms_done(上下文) check_ctx_status(上下文) do mongocrypt_ctx_kms_done(上下文.ctx_p) end end |
。 ctx_mongo_feed (context, doc) ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
将驱动程序的响应反馈给 libmongocrypt
895 896 897 898 899 900 901 902 903 |
# File 'lib/ Mongo/crypt/bounding.rb', line 895 def self.ctx_mongo_feed(上下文, doc) validate_document(doc) 数据 = doc.to_bson.to_s 二进制文件.wrapp_string(数据) do |data_p| check_ctx_status(上下文) do mongocrypt_ctx_mongo_feed(上下文.ctx_p, data_p) end end end |
.ctx_mongo_op(context) ⇒ BSON::Document
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
返回一个BSON::文档,表示驱动程序必须代表 libmongocrypt 执行以获取所需信息以继续加密/解密的操作(示例,用于密钥保管库查询的过滤器)。
866 867 868 869 870 871 872 873 874 875 876 877 |
# File 'lib/ Mongo/crypt/bounding.rb', line 866 def self.ctx_mongo_op(上下文) 二进制文件 = 二进制文件.new check_ctx_status(上下文) do mongocrypt_ctx_mongo_op(上下文.ctx_p, 二进制文件.ref) end # TODO:由于二进制文件引用了C指针,而 ByteBuffer 是 # 在 MRI 中用 C 语言编写,我们可以省略数据副本,方法是 # ByteBuffer 引用 libmongocrypt 拥有的string 。 BSON::文档.from_bson(BSON::ByteBuffer.new(二进制文件.to_s), 模式: :bson) end |
.ctx_next_kms_ctx(context) ⇒ Mongo::Crypt::KmsContext | nil
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
返回 Context对象所需的新 KmsContext对象。
927 928 929 930 931 932 933 934 935 |
# File 'lib/ Mongo/crypt/bounding.rb', line 927 def self.ctx_next_kms_ctx(上下文) kms_ctx_p = mongocrypt_ctx_next_kms_ctx(上下文.ctx_p) if kms_ctx_p.null? nil else KmsContext.new(kms_ctx_p) end end |
。 ctx_provide_kms_providers (context, kms_providers) ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
为响应 MONGOCRYPT_CTX_NEED_KMS_CREDENTIALS 状态而调用,以设立每个上下文的KMS提供商程序设置。它们遵循与“mongocrypt_setopt_kms_providers”相同的格式。如果BSON输入中不存在密钥,则使用初始化时为 mongocrypt_t 配置的KMS提供商程序设置。
1681 1682 1683 1684 1685 1686 1687 1688 1689 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1681 def self.ctx_provide_kms_providers(上下文, kms_providers) validate_document(kms_providers) 数据 = kms_providers.to_bson.to_s 二进制文件.wrapp_string(数据) do |data_p| check_ctx_status(上下文) do mongocrypt_ctx_provide_kms_providers(上下文.ctx_p, data_p) end end end |
。 ctx_rewrap_many_datakey_init (context, 过滤) ⇒ Boolean
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
初始化上下文以重新包装数据键。
654 655 656 657 658 659 660 661 |
# File 'lib/ Mongo/crypt/bounding.rb', line 654 def self.ctx_rewrap_many_datakey_init(上下文, 筛选器) filter_data = 筛选器.to_bson.to_s 二进制文件.wrapp_string(filter_data) do |data_p| check_ctx_status(上下文) do mongocrypt_ctx_rewrap_many_datakey_init(上下文.ctx_p, data_p) end end end |
。 ctx_setopt_algorithm (context, name) ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
根据上下文设置算法
567 568 569 570 571 |
# File 'lib/ Mongo/crypt/bounding.rb', line 567 def self.ctx_setopt_algorithm(上下文, 名称) check_ctx_status(上下文) do mongocrypt_ctx_setopt_algorithm(上下文.ctx_p, 名称, -1) end end |
。 ctx_setopt_algorithm_range (context, opts) ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
范围算法仅处于实验阶段。 它不适用于
设置使用“范围”算法进行显式加密的选项。
公共使用。
1788 1789 1790 1791 1792 1793 1794 1795 1796 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1788 def self.ctx_setopt_algorithm_range(上下文, opts) validate_document(opts) 数据 = opts.to_bson.to_s 二进制文件.wrapp_string(数据) do |data_p| check_ctx_status(上下文) do mongocrypt_ctx_setopt_algorithm_range(上下文.ctx_p, data_p) end end end |
。 ctx_setopt_contention_factor (context,factor) ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
设置用于显式加密的争用因子。 争用因子仅用于索引式 FLE 2加密。
1751 1752 1753 1754 1755 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1751 def self.ctx_setopt_contention_factor(上下文, 因素) check_ctx_status(上下文) do mongocrypt_ctx_setopt_contention_factor(上下文.ctx_p, 因素) end end |
。 ctx_setopt_key_alt_names (context, key_alt_names) ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
在创建数据密钥时设置多个备用密钥名称
498 499 500 501 502 503 504 505 506 507 508 |
# File 'lib/ Mongo/crypt/bounding.rb', line 498 def self.ctx_setopt_key_alt_names(上下文, key_alt_names) key_alt_names.每 do |key_alt_name| key_alt_name_bson = { keyAltName: key_alt_name }.to_bson.to_s 二进制文件.wrapp_string(key_alt_name_bson) do |key_alt_name_p| check_ctx_status(上下文) do mongocrypt_ctx_setopt_key_alt_name(上下文.ctx_p, key_alt_name_p) end end end end |
。 ctx_setopt_key_encryption_key (context, key_document) ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
设置用于创建数据密钥的密钥加密密钥文档。
596 597 598 599 600 601 602 603 604 |
# File 'lib/ Mongo/crypt/bounding.rb', line 596 def self.ctx_setopt_key_encryption_key(上下文, key_document) validate_document(key_document) 数据 = key_document.to_bson.to_s 二进制文件.wrapp_string(数据) do |data_p| check_ctx_status(上下文) do mongocrypt_ctx_setopt_key_encryption_key(上下文.ctx_p, data_p) end end end |
.ctx_setopt_key_id(context, key_id) ⇒ Object
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
在显式加密上下文中设置密钥 ID 选项。
465 466 467 468 469 470 471 |
# File 'lib/ Mongo/crypt/bounding.rb', line 465 def self.ctx_setopt_key_id(上下文, key_id) 二进制文件.wrapp_string(key_id) do |key_id_p| check_ctx_status(上下文) do mongocrypt_ctx_setopt_key_id(上下文.ctx_p, key_id_p) end end end |
。 ctx_setopt_key_material (context, key_material) ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
设置用于加密数据的自定义密钥材料。
533 534 535 536 537 538 539 540 |
# File 'lib/ Mongo/crypt/bounding.rb', line 533 def self.ctx_setopt_key_material(上下文, key_material) 数据 = { ' keyMaterial ' => key_material }.to_bson.to_s 二进制文件.wrapp_string(数据) do |data_p| check_ctx_status(上下文) do mongocrypt_ctx_setopt_key_material(上下文.ctx_p, data_p) end end end |
。 ctx_setopt_query_type (context, query_type) ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
设置用于 FLE 2显式加密的查询类型。 查询类型仅用于索引 FLE 2加密。
1719 1720 1721 1722 1723 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1719 def self.ctx_setopt_query_type(上下文, query_type) check_ctx_status(上下文) do mongocrypt_ctx_setopt_query_type(上下文.ctx_p, query_type, -1) end end |
。 get_binary_data_direct (mongocrypt_binary_t) ⇒ 对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
179 180 181 |
# File 'lib/ Mongo/crypt/bounding.rb', line 179 def self.get_binary_data_direct(mongocrypt_binary_t) mongocrypt_binary_t.get_pointer(0) end |
。 get_binary_len_direct (mongocrypt_binary_t) ⇒ 对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
183 184 185 |
# File 'lib/ Mongo/crypt/bounding.rb', line 183 def self.get_binary_len_direct(mongocrypt_binary_t) mongocrypt_binary_t.get_uint32(FFI::NativeType::POINTER.size) end |
。 init (处理) ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
初始化 Mongo::Crypt::Handle对象
405 406 407 408 409 |
# File 'lib/ Mongo/crypt/bounding.rb', line 405 def self.init(处理) check_status(处理) do mongocrypt_init(处理.ref) end end |
。 kms_ctx_bytes_needed (kms_context) ⇒整数
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
获取 KmsContext 所需的字节数。
1061 1062 1063 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1061 def self.kms_ctx_bytes_needed(kms_context) mongocrypt_kms_ctx_bytes_needed(kms_context.kms_ctx_p) end |
.kms_ctx_endpoint(kms_context) ⇒ String | nil
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
获取通过 TLS 连接的主机名,以获取有关Amazon Web Services主密钥的信息。
1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1037 def self.kms_ctx_endpoint(kms_context) ptr = FFI::内存指针.new(:pointer, 1) check_kms_ctx_status(kms_context) do mongocrypt_kms_ctx_endpoint(kms_context.kms_ctx_p, ptr) end str_ptr = ptr.read_pointer str_ptr.null? ? nil : str_ptr.read_string.force_encoding('UTF-8') end |
。 kms_ctx_fail (kms_context) ⇒ true , false
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
检查是否可以重试上次失败的KMS上下文请求。
1146 1147 1148 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1146 def self.kms_ctx_fail(kms_context) mongocrypt_kms_ctx_fail(kms_context.kms_ctx_p) end |
。 kms_ctx_feed (kms_context, bytes) ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
将KMS的回复反馈回 libmongocrypt。
1081 1082 1083 1084 1085 1086 1087 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1081 def self.kms_ctx_feed(kms_context, 字节) check_kms_ctx_status(kms_context) do 二进制文件.wrapp_string(字节) do |bytes_p| mongocrypt_kms_ctx_feed(kms_context.kms_ctx_p, bytes_p) end end end |
。 kms_ctx_get_kms_provider (kms_context) ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
获取与此KMS请求关联的KMS提供商标识符。
用于根据KMS请求有条件地配置 TLS 连接。 它对于 KMIP 非常有用,因为它使用客户端证书进行身份验证。
968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 |
# File 'lib/ Mongo/crypt/bounding.rb', line 968 def self.kms_ctx_get_kms_provider(kms_context) len_ptr = FFI::内存指针.new(:uint 32, 1) provider = mongocrypt_kms_ctx_get_kms_provider( kms_context.kms_ctx_p, len_ptr ) if len_ptr.nil? nil else len = if BSON::environment.jRuby? # JRuby FFI实施没有“read(type)”方法,但它 # 有这个 `get_uint 32 `。 len_ptr.get_uint32 else # 对于 MRI,我们使用已记录的“读取”方法 - https://www.Rubydoc.info/github/ffi/ffi/FFI% 2 FPointer:read len_ptr.读(:uint 32) end provider.read_string(len).to_sym end end |
。 kms_ctx_message (kms_context) ⇒ string
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
HTTP获取从Amazon Web ServicesKMS KmsContext对象获取 主密钥所需的 消息。
1008 1009 1010 1011 1012 1013 1014 1015 1016 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1008 def self.(kms_context) 二进制文件 = 二进制文件.new check_kms_ctx_status(kms_context) do (kms_context.kms_ctx_p, 二进制文件.ref) end 二进制文件.to_s end |
.kms_ctx_setopt_retry_kms(handle, value) ⇒ true, fale
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
启用或禁用KMS重试行为。
1165 1166 1167 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1165 def self.kms_ctx_setopt_retry_kms(处理, 值) mongocrypt_setopt_retry_kms(处理.ref, 值) end |
.kms_ctx_usleep(kms_context) ⇒ Integer
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
返回在为给定KMS上下文发送KMS请求之前处于休眠状态的毫秒数。
1129 1130 1131 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1129 def self.kms_ctx_usleep(kms_context) mongocrypt_kms_ctx_usleep(kms_context.kms_ctx_p) end |
。 mongocrypt_binary_data (binary) ⇒ FFI::Pointer
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
获取指向 mongocrypt_binary_t根本的数据的指针。
169 |
# File 'lib/ Mongo/crypt/bounding.rb', line 169 附加函数 :mongocrypt_binary_data, [ :pointer ], :pointer |
。 mongocrypt_binary_destroy (binary) ⇒ nil
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
销毁 mongocrypt_binary_t对象。
193 |
# File 'lib/ Mongo/crypt/bounding.rb', line 193 附加函数 :mongocrypt_binary_destroy, [ :pointer ], :void |
。 mongocrypt_binary_len (binary) ⇒整数
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
获取基础数据数组的长度。
177 |
# File 'lib/ Mongo/crypt/bounding.rb', line 177 附加函数 :mongocrypt_binary_len, [ :pointer ], :int |
。 mongocrypt_binary_new ⇒ FFI::Pointer
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
创建新的 mongocrypt_binary_t 对象(字节数组的非拥有视图)。
145 |
# File 'lib/ Mongo/crypt/bounding.rb', line 145 附加函数 :mongocrypt_binary_new, [], :pointer |
。 mongocrypt_binary_new_from_data (data, len) ⇒ FFI::Pointer
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
创建一个新的 mongocrypt_binary_t 对象,用于维护指向指定字节数组的指针。
157 158 159 160 161 |
# File 'lib/ Mongo/crypt/bounding.rb', line 157 附加函数( :mongocrypt_binary_new_from_data, %i[指针 int], :pointer ) |
。 mongocrypt_crypt_shared_lib_version (crypt) ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
1586 1587 1588 1589 1590 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1586 附加函数( :mongocrypt_crypt_shared_lib_version, [ :pointer ], :uint 64 ) |
。 mongocrypt_ctx_datakey_init (ctx, filter) ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
616 |
# File 'lib/ Mongo/crypt/bounding.rb', line 616 附加函数 :mongocrypt_ctx_datakey_init, [ :pointer ], :bool |
.mongocrypt_ctx_decrypt_init(ctx, doc) ⇒ Boolean
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
初始化 ctx 以进行自动解密。
776 |
# File 'lib/ Mongo/crypt/bounding.rb', line 776 附加函数 :mongocrypt_ctx_decrypt_init, %i[指针 指针], :bool |
。 mongocrypt_ctx_destroy (ctx) ⇒ nil
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
销毁对 mongocrypt_ctx_t对象的引用。
1225 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1225 附加函数 :mongocrypt_ctx_destroy, [ :pointer ], :void |
.mongocrypt_ctx_encrypt_init(ctx, db, db_len, cmd) ⇒ Boolean
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
此方法要求传入的BSON采用以下格式:{ "v": BSON value tocrypt }。
初始化 ctx 以进行自动加密。
676 677 678 679 680 |
# File 'lib/ Mongo/crypt/bounding.rb', line 676 附加函数( :mongocrypt_ctx_encrypt_init, %i[指针 字符串 int 指针], :bool ) |
.mongocrypt_ctx_explicit_decrypt_init(ctx, msg) ⇒ Boolean
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
为显式解密初始化 ctx。
802 803 804 805 806 |
# File 'lib/ Mongo/crypt/bounding.rb', line 802 附加函数( :mongocrypt_ctx_explicit_decrypt_init, %i[指针 指针], :bool ) |
.mongocrypt_ctx_explicit_encrypt_init(ctx, msg) ⇒ Boolean
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
在调用该方法之前,请使用以下方法设立key_id、key_alt_name(可选)和加密算法:mongocrypt_ctx_setopt_key_id、mongocrypt_ctx_setopt_key_alt_name 和 mongocrypt_ctx_setopt_algorithm。
为显式表达式加密初始化 ctx。
712 713 714 715 716 |
# File 'lib/ Mongo/crypt/bounding.rb', line 712 附加函数( :mongocrypt_ctx_explicit_encrypt_init, %i[指针 指针], :bool ) |
。 mongocrypt_ctx_finalize (ctx, op_bson) ⇒布尔值
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
执行最终的加密或解密,并返回BSON文档。
1198 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1198 附加函数 :mongocrypt_ctx_finalize, %i[指针 指针], :void |
.mongocrypt_ctx_mongo_done(ctx) ⇒ Boolean
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
指示 libmongocrypt 驱动程序已完成提供回复。
911 |
# File 'lib/ Mongo/crypt/bounding.rb', line 911 附加函数 :mongocrypt_ctx_mongo_done, [ :pointer ], :bool |
。 mongocrypt_ctx_mongo_feed (ctx,reply) ⇒布尔值
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
将BSON回复发送给 libmongocrypt。
887 |
# File 'lib/ Mongo/crypt/bounding.rb', line 887 附加函数 :mongocrypt_ctx_mongo_feed, %i[指针 指针], :bool |
。 mongocrypt_ctx_mongo_next_kms_ctx (ctx) ⇒ FFI::Pointer
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
返回指向 mongocrypt_kms_ctx_t对象的指针或 NULL。
919 |
# File 'lib/ Mongo/crypt/bounding.rb', line 919 附加函数 :mongocrypt_ctx_next_kms_ctx, [ :pointer ], :pointer |
。 mongocrypt_ctx_mongo_op (ctx, op_bson) ⇒布尔值
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
获取驱动程序的BSON操作,以针对MongoDB集合、密钥保管库数据库或 mongocryptd运行。
855 |
# File 'lib/ Mongo/crypt/bounding.rb', line 855 附加函数 :mongocrypt_ctx_mongo_op, %i[指针 指针], :bool |
。 mongocrypt_ctx_new (crypt) ⇒ FFI::Pointer
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
创建一个新的 mongocrypt_ctx_t对象(libmongocrypt 状态机的包装器)。
第 436 章 |
# File 'lib/ Mongo/crypt/bounding.rb', line 436 附加函数 :mongocrypt_ctx_new, [ :pointer ], :pointer |
。 mongocrypt_ctx_provide_kms_providers (ctx, kms_providers) ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
1664 1665 1666 1667 1668 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1664 附加函数( :mongocrypt_ctx_provide_kms_providers, %i[指针 指针], :bool ) |
。 mongocrypt_ctx_setopt_algorithm (ctx, 算法, len) ⇒ Boolean
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
在调用此方法之前,请勿初始化 ctx。
设置用于显式加密的算法。
553 554 555 556 557 |
# File 'lib/ Mongo/crypt/bounding.rb', line 553 附加函数( :mongocrypt_ctx_setopt_algorithm, %i[指针 字符串 int], :bool ) |
。 mongocrypt_ctx_setopt_algorithm_range (ctx, opts) ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
1770 1771 1772 1773 1774 1775 1776 1777 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1770 附加函数( :mongocrypt_ctx_setopt_algorithm_range, %i[ 指针 指针 ], :bool ) |
。 mongocrypt_ctx_setopt_contention_factor (ctx,contention_factor) ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
1735 1736 1737 1738 1739 1740 1741 1742 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1735 附加函数( :mongocrypt_ctx_setopt_contention_factor, %i[ 指针 int64 ], :bool ) |
。 mongocrypt_ctx_setopt_key_alt_name (ctx, binary) ⇒ Boolean
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
在调用此方法之前,请勿初始化 ctx。
创建数据密钥时,请为该密钥设立备用名称。执行显式加密时,根据 keyAltName字段指定使用哪个数据密钥进行加密。
485 486 487 488 489 |
# File 'lib/ Mongo/crypt/bounding.rb', line 485 附加函数( :mongocrypt_ctx_setopt_key_alt_name, %i[指针 指针], :bool ) |
。 mongocrypt_ctx_setopt_key_encryption_key (ctx) ⇒布尔值
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
在调用此方法之前,请勿初始化 ctx。
设置用于创建数据密钥的密钥加密密钥文档。
583 584 585 586 587 |
# File 'lib/ Mongo/crypt/bounding.rb', line 583 附加函数( :mongocrypt_ctx_setopt_key_encryption_key, %i[指针 指针], :bool ) |
.mongocrypt_ctx_setopt_key_id(ctx, key_id) ⇒ Boolean
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
在调用此方法之前,请勿初始化 ctx。
设置用于显式加密的密钥 ID。
第 457 章 |
# File 'lib/ Mongo/crypt/bounding.rb', line 457 附加函数 :mongocrypt_ctx_setopt_key_id, %i[指针 指针], :bool |
。 mongocrypt_ctx_setopt_key_material (ctx, binary) ⇒ Boolean
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
在调用此方法之前,请勿初始化 ctx。
创建数据密钥时,请设立用于加密数据的自定义密钥材料。
520 521 522 523 524 |
# File 'lib/ Mongo/crypt/bounding.rb', line 520 附加函数( :mongocrypt_ctx_setopt_key_material, %i[指针 指针], :bool ) |
。 mongocrypt_ctx_setopt_query_type (ctx, mongocrypt_query_type) ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
1702 1703 1704 1705 1706 1707 1708 1709 1710 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1702 附加函数( :mongocrypt_ctx_setopt_query_type, %i[ 指针 字符串 int ], :bool ) |
。 mongocrypt_ctx_state (ctx) ⇒符号
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
获取 ctx 的当前状态。
843 |
# File 'lib/ Mongo/crypt/bounding.rb', line 843 附加函数 :mongocrypt_ctx_state, [ :pointer ], :mongocrypt_ctx_state |
。 mongocrypt_ctx_status (ctx, status) ⇒ Boolean
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
在 mongocrypt_status_t对象上设置来自 mongocrypt_ctx_t对象的状态信息。
第 446 章 |
# File 'lib/ Mongo/crypt/bounding.rb', line 446 附加函数 :mongocrypt_ctx_status, %i[指针 指针], :bool |
。 mongocrypt_destroy (crypt) ⇒ nil
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
销毁对 mongocrypt_t 对象的引用。
第 427 章 |
# File 'lib/ Mongo/crypt/bounding.rb', line 427 附加函数 :mongocrypt_destroy, [ :pointer ], :void |
。 mongocrypt_init (crypt) ⇒布尔值
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
初始化 mongocrypt_t对象。
398 |
# File 'lib/ Mongo/crypt/bounding.rb', line 398 附加函数 :mongocrypt_init, [ :pointer ], :bool |
。 mongocrypt_kms_ctx_bytes_needed ( KMS ) ⇒整数
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
获取KMS上下文所需的字节数。
1054 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1054 附加函数 :mongocrypt_kms_ctx_bytes_needed, [ :pointer ], :int |
.mongocrypt_kms_ctx_done(ctx) ⇒ Boolean
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
指示 libmongocrypt,它将不再收到来自 mongocrypt_kms_ctx_t 对象的回复。
1176 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1176 附加函数 :mongocrypt_ctx_kms_done, [ :pointer ], :bool |
。 mongocrypt_kms_ctx_endpoint ( KMS , endpoint) ⇒ Boolean
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
获取通过 TLS 连接的主机名,以获取有关Amazon Web Services主密钥的信息。
1027 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1027 附加函数 :mongocrypt_kms_ctx_endpoint, %i[指针 指针], :bool |
.mongocrypt_kms_ctx_fail(ctx) ⇒ Object
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
1140 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1140 附加函数 :mongocrypt_kms_ctx_fail, [ :pointer ], :bool |
。 mongocrypt_kms_ctx_feed ( KMS , bytes) ⇒布尔值
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
将KMS的回复反馈回 libmongocrypt。
1073 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1073 附加函数 :mongocrypt_kms_ctx_feed, %i[指针 指针], :bool |
。 mongocrypt_kms_ctx_get_kms_provider (crypt, kms_providers) ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
953 954 955 956 957 |
# File 'lib/ Mongo/crypt/bounding.rb', line 953 附加函数( :mongocrypt_kms_ctx_get_kms_provider, %i[指针 指针], :pointer ) |
。 mongocrypt_kms_ctx_message ( KMS , msg) ⇒布尔值
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
获取获取Amazon Web Services KMS主密钥所需的消息。
998 |
# File 'lib/ Mongo/crypt/bounding.rb', line 998 附加函数 :mongocrypt_kms_ctx_message, %i[指针 指针], :bool |
。 mongocrypt_kms_ctx_status ( KMS , status) ⇒布尔值
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
将有关 mongocrypt_kms_ctx_t 对象的状态信息写入 mongocrypt_status_t 对象。
1097 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1097 附加函数 :mongocrypt_kms_ctx_status, %i[指针 指针], :bool |
.mongocrypt_kms_ctx_usleep(ctx) ⇒ int64
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
指示发送KMS请求之前的休眠时间。
1121 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1121 附加函数 :mongocrypt_kms_ctx_usleep, [ :pointer ], :int 64 |
。 mongocrypt_setopt_aes_ 256 _ctr (crypt, aes_ 256 _ctr_encrypt, aes_ 256 _ctr_decrypt, ctx) ⇒布尔值
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
为 AES 256 -CTR 操作设置加密钩子。
1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1482 附加函数( :mongocrypt_setopt_aes_256_ctr, %i[ 指针 mongocrypt_crypto_fn mongocrypt_crypto_fn 指针 ], :bool ) |
。 mongocrypt_setopt_append_crypt_shared_lib_search_path (crypt, path) ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
1519 1520 1521 1522 1523 1524 1525 1526 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1519 附加函数( :mongocrypt_setopt_append_crypt_shared_lib_search_path, %i[ 指针 字符串 ], :void ) |
。 mongocrypt_setopt_bypass_query_analysis (crypt) ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
1458 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1458 附加函数(:mongocrypt_setopt_bypass_query_analysis, [ :pointer ], :void) |
。 mongocrypt_setopt_crypto_hook_sign_rsaes_pkcs 1 _v 1 _ 5 (crypt, sign_rsaes_pkcs 1 _v 1 _ 5 , ctx = nil) ⇒布尔值
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
使用 SHA- 256哈希为 RSASSA-PKCS 1 -v 1 _ 5算法设置加密钩子。
1375 1376 1377 1378 1379 1380 1381 1382 1383 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1375 附加函数( :mongocrypt_setopt_crypto_hook_sign_rsaes_pkcs 1 _v 1 _ 5, %i[ 指针 mongocrypt_hmac_fn 指针 ], :bool ) |
.mongocrypt_setopt_crypto_hooks(crypt, aes_enc_fn, aes_dec_fn, random_fn, sha_512_fn, sha_256_fn, hash_fn, ctx = nil) ⇒ Boolean
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
在提供的 mongocrypt对象上设置加密钩子。
1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1330 附加函数( :mongocrypt_setopt_crypto_hooks, %i[ 指针 mongocrypt_crypto_fn mongocrypt_crypto_fn mongocrypt_random_fn mongocrypt_hmac_fn mongocrypt_hmac_fn mongocrypt_hash_fn 指针 ], :bool ) |
。 mongocrypt_setopt_encrypted_field_config_map (crypt, efc_map) ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
1417 1418 1419 1420 1421 1422 1423 1424 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1417 附加函数( :mongocrypt_setopt_encrypted_field_config_map, %i[ 指针 指针 ], :bool ) |
。 mongocrypt_setopt_kms_providers (crypt, kms_providers) ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
在调用此方法之前,请勿初始化 ctx。
使用BSON文档配置KMS提供商。
342 343 344 345 346 |
# File 'lib/ Mongo/crypt/bounding.rb', line 342 附加函数( :mongocrypt_setopt_kms_providers, %i[指针 指针], :bool ) |
。 mongocrypt_setopt_log_handler (crypt, log_fn, log_ctx = nil) ⇒ Boolean
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
将 mongocrypt_t 对象上的处理程序设置为在每次 libmongocrypt 记录消息时调用。
313 314 315 316 317 |
# File 'lib/ Mongo/crypt/bounding.rb', line 313 附加函数( :mongocrypt_setopt_log_handler, %i[指针 mongocrypt_log_fn_t 指针], :bool ) |
。 mongocrypt_setopt_retry_kms (crypt, 启用) ⇒ 对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
1158 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1158 附加函数 :mongocrypt_setopt_retry_kms, %i[指针 bool], :bool |
。 mongocrypt_setopt_schema_map (crypt, schema_map) ⇒布尔值
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
设置用于加密的本地模式映射。
373 |
# File 'lib/ Mongo/crypt/bounding.rb', line 373 附加函数 :mongocrypt_setopt_schema_map, %i[指针 指针], :bool |
。 mongocrypt_setopt_set_crypt_shared_lib_path_override (crypt, path) ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
1548 1549 1550 1551 1552 1553 1554 1555 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1548 附加函数( :mongocrypt_setopt_set_crypt_shared_lib_path_override, %i[ 指针 字符串 ], :void ) |
。 mongocrypt_setopt_use_need_kms_credentials_state (crypt) ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
1627 1628 1629 1630 1631 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1627 附加函数( :mongocrypt_setopt_use_need_kms_credentials_state, [ :pointer ], :void ) |
。 mongocrypt_status (crypt, status) ⇒ Boolean
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
在 mongocrypt_status_t对象上设置 mongocrypt_t对象的状态信息。
419 |
# File 'lib/ Mongo/crypt/bounding.rb', line 419 附加函数 :mongocrypt_status, %i[指针 指针], :bool |
。 mongocrypt_status_code (status) ⇒整数
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
返回状态错误代码。
241 |
# File 'lib/ Mongo/crypt/bounding.rb', line 241 附加函数 :mongocrypt_status_code, [ :pointer ], :int |
。 mongocrypt_status_destroy (status) ⇒ nil
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
销毁对 mongocrypt_status_t 对象的引用。
267 |
# File 'lib/ Mongo/crypt/bounding.rb', line 267 附加函数 :mongocrypt_status_destroy, [ :pointer ], :void |
.mongocrypt_status_message(status, len = nil) ⇒ String
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
返回状态消息。
251 |
# File 'lib/ Mongo/crypt/bounding.rb', line 251 附加函数 :mongocrypt_status_message, %i[指针 指针], : 细绳 |
。 mongocrypt_status_new ⇒ FFI::Pointer
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
创建新的 mongocrypt_status_t 对象。
207 |
# File 'lib/ Mongo/crypt/bounding.rb', line 207 附加函数 :mongocrypt_status_new, [], :pointer |
。 mongocrypt_status_ok (status) ⇒布尔值
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
返回状态是正常还是错误。
259 |
# File 'lib/ Mongo/crypt/bounding.rb', line 259 附加函数 :mongocrypt_status_ok, [ :pointer ], :bool |
。 mongocrypt_status_set (status, type, code, message, len) ⇒ nil
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
在现有状态上设置消息、类型和代码。
221 222 223 224 225 |
# File 'lib/ Mongo/crypt/bounding.rb', line 221 附加函数( :mongocrypt_status_set, %i[指针 status_type int 字符串 int], :void ) |
.mongocrypt_status_type(status) ⇒ Symbol
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
指示状态类型。
233 |
# File 'lib/ Mongo/crypt/bounding.rb', line 233 附加函数 :mongocrypt_status_type, [ :pointer ], :status_type |
。 mongocrypt_version (len) ⇒ string
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
返回 libmongocrypt 库的版本string 。
93 |
# File 'lib/ Mongo/crypt/bounding.rb', line 93 附加函数 :mongocrypt_version, [ :pointer ], : 细绳 |
。 ongocrypt_new ⇒ FFI::Pointer
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
创建新的 mongocrypt_t对象。
301 |
# File 'lib/ Mongo/crypt/bounding.rb', line 301 附加函数 :mongocrypt_new, [], :pointer |
.parse_version(version) ⇒ Gem::Version
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
给定一个表示版本号的string ,将其解析为一个 Gem::Version对象。 这会通过执行一些自定义解析来处理string不是 Gem::Version 支持的格式的情况。
106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/ Mongo/crypt/bounding.rb', line 106 def self.parse_version(版本) Gem::版本.new(版本) 救援 ArgumentError 匹配 = 版本.匹配(/\A(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)?(-[A-Za-z+\d]+)?\z/) 提高 ArgumentError.new("格式不正确的版本号string #{ version } ") if 匹配.nil? Gem::版本.new( [ 匹配[:major], 匹配[:minor], 匹配[:patch] ].连接 (JOIN)(' 。 ') ) end |
。 setopt_aes_ 256 _ctr (处理, aes_ctr_encrypt_cb, aes_ctr_decrypt_cb) ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
为 AES 256 -CTR 操作设置加密钩子。
1500 1501 1502 1503 1504 1505 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1500 def self.setopt_aes_ 256 _ctr(处理, aes_ctr_encrypt_cb, aes_ctr_decrypt_cb) check_status(处理) do mongocrypt_setopt_aes_ 256 _ctr(处理.ref, aes_ctr_encrypt_cb, aes_ctr_decrypt_cb, nil) end end |
。 setopt_append_crypt_shared_lib_search_path (handle, path) ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
在搜索路径中追加一个搜索目录,用于加载 crypt_shared 动态库。
1533 1534 1535 1536 1537 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1533 def self.setopt_append_crypt_shared_lib_search_path(处理, 路径) check_status(处理) do mongocrypt_setopt_append_crypt_shared_lib_search_path(处理.ref, 路径) end end |
。 setopt_bypass_query_analysis (handle) ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
选择跳过查询分析。
如果选择了:
- 不会尝试加载 csfle 共享库。
- mongocrypt_ctx_t 永远不会进入 MONGOCRYPT_CTX_NEED_MARKINGS 状态。
1467 1468 1469 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1467 def self.setopt_bypass_query_analysis(处理) mongocrypt_setopt_bypass_query_analysis(处理.ref) end |
。 setopt_crypto_hook_sign_rsaes_pkcs 1 _v 1 _ 5 (处理, rsaes_pkcs_signature_cb) ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
使用 SHA- 256哈希值或句柄为 RSASSA-PKCS 1 -v 1 _ 5算法设置加密钩子。
1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1392 def self.setopt_crypto_hook_sign_rsaes_pkcs 1 _v 1 _ 5( 处理, rsaes_pkcs_signature_cb ) check_status(处理) do mongocrypt_setopt_crypto_hook_sign_rsaes_pkcs 1 _v 1 _ 5( 处理.ref, rsaes_pkcs_signature_cb, nil ) end end |
。 setopt_crypto_hooks (handle, aes_encrypt_cb, aes_decrypt_cb, random_cb, hmac_sha_ 512 _cb, hmac_sha_ 256 _cb, hmac_hash_cb) ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
在句柄上设置加密回调
1356 1357 1358 1359 1360 1361 1362 1363 1364 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1356 def self.setopt_crypto_hooks(处理, aes_encrypt_cb, aes_decrypt_cb, random_cb, hmac_sha_ 512 _cb, hmac_sha_ 256 _cb, hmac_hash_cb) check_status(处理) do mongocrypt_setopt_crypto_hooks(处理.ref, aes_encrypt_cb, aes_decrypt_cb, random_cb, hmac_sha_ 512 _cb, hmac_sha_ 256 _cb, hmac_hash_cb, nil) end end |
。 setopt_encrypted_field_config_map (处理, efc_map) ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
设置用于加密的本地 EncryptedFieldConfigMap。
1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1435 def self.setopt_crypted_field_config_map(处理, efc_map) validate_document(efc_map) 数据 = efc_map.to_bson.to_s 二进制文件.wrapp_string(数据) do |data_p| check_status(处理) do mongocrypt_setopt_encrypted_field_config_map( 处理.ref, data_p ) end end end |
。 setopt_kms_providers (处理, kms_providers) ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
在 Mongo::Crypt::Handle对象上设置KMS提供程序选项
355 356 357 358 359 360 361 362 363 |
# File 'lib/ Mongo/crypt/bounding.rb', line 355 def self.setopt_kms_providers(处理, kms_providers) validate_document(kms_providers) 数据 = kms_providers.to_bson.to_s 二进制文件.wrapp_string(数据) do |data_p| check_status(处理) do mongocrypt_setopt_kms_providers(处理.ref, data_p) end end end |
。 setopt_log_handler (处理, log_callback) ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
在 Mongo::Crypt::Handle对象上设置记录器回调函数
325 326 327 328 329 |
# File 'lib/ Mongo/crypt/bounding.rb', line 325 def self.setopt_log_handler(处理, log_callback) check_status(处理) do mongocrypt_setopt_log_handler(处理, log_callback, nil) end end |
。 setopt_schema_map (处理, schema_map_doc) ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
在 Mongo::Crypt::Handle对象上设置模式映射
382 383 384 385 386 387 388 389 390 |
# File 'lib/ Mongo/crypt/bounding.rb', line 382 def self.setopt_schema_map(处理, schema_map_doc) validate_document(schema_map_doc) 数据 = schema_map_doc.to_bson.to_s 二进制文件.wrapp_string(数据) do |data_p| check_status(处理) do mongocrypt_setopt_schema_map(处理.ref, data_p) end end end |
。 setopt_set_crypt_shared_lib_path_override (handle, path) ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
设置用于加载 crypt 共享库的单个覆盖路径。
1561 1562 1563 1564 1565 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1561 def self.setopt_set_crypt_shared_lib_path_override(处理, 路径) check_status(处理) do mongocrypt_setopt_set_crypt_shared_lib_path_override(处理.ref, 路径) end end |
。 setopt_use_need_kms_credentials_state (处理) ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
选择处理 MONGOCRYPT_CTX_NEED_KMS_CREDENTIALS 状态。
如果设立},则在进入 MONGOCRYPT_CTX_NEED_KMS 状态之前,上下文可能会进入 MONGOCRYPT_CTX_NEED_KMS_CREDENTIALS 状态,然后等待通过 mongocrypt_ctx_provide_kms_providers 提供凭证。
仅当在 mongocrypt_setopt_kms_providers 中为KMS提供商程序设立了空文档时,上下文才会输入 MONGOCRYPT_CTX_NEED_KMS_CREDENTIALS。
1645 1646 1647 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1645 def self.setopt_use_need_kms_credentials_state(处理) mongocrypt_setopt_use_need_kms_credentials_state(处理.ref) end |
.validate_document(data) ⇒ Object
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
所有BSON::Document 实例也是哈希实例
在将指定数据序列化为BSON之前检查其是否为哈希,以防止 libmongocrypt 出错
1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1838 def self.validate_document(数据) return if 数据.is_a?(哈希) = if 数据.nil? ' 尝试将 nil 数据传递给 libmongocrypt。 ' + 'Data must be a Hash' else "尝试将无效数据传递给 libmongocrypt: #{ data } " + 'Data must be a Hash' end 提高 错误::CryptError.new() end |
.validate_version(lmc_version) ⇒ Object
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
验证提供的 libmongocrypt 版本是否有效,即等于或大于所需的最低版本。 如果没有,则引发 LoadError。
129 130 131 132 133 134 |
# File 'lib/ Mongo/crypt/bounding.rb', line 129 def self.validate_version(lmc_version) if (实际版本 = parse_version(lmc_version)) < MIN_LIBMongOCRYPT_VERSION 提高 LoadError, "需要 libmongocrypt 版本#{ MIN_LIBMongOCRYPT_VERSION }或更高版本, " + “但找到了版本#{ actual_version } 。 ” end end |
实例方法详细信息
#mongocrypt_crypto_fn(ctx, key, iv, input, output, status) ⇒ Bool
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
这定义了 FFI回调的方法签名;它不是 Binding 类的实例方法。
对执行 AES加密或解密的函数的回调。
1248 1249 1250 1251 1252 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1248 callback( :mongocrypt_crypto_fn, %i[指针 指针 指针 指针 指针 指针 指针], :bool ) |
# mongocrypt_hash_fn (ctx, input, output, status) ⇒ Bool
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
这定义了 FFI回调的方法签名;它不是 Binding 类的实例方法。
对 SHA- 256哈希函数的回调。
1296 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1296 callback :mongocrypt_hash_fn, %i[指针 指针 指针 指针], :bool |
# mongocrypt_hmac_fn (ctx, key, input, output, status) ⇒ Bool
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
这定义了 FFI回调的方法签名;它不是 Binding 类的实例方法。
对执行 HMAC SHA- 512或 SHA- 256的函数的回调。
1273 1274 1275 1276 1277 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1273 callback( :mongocrypt_hmac_fn, %i[指针 指针 指针 指针 指针], :bool ) |
# mongocrypt_log_fn_t (level, message, len, ctx) ⇒ nil
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
这定义了 FFI回调的方法签名;它不是 Binding 类的实例方法。
对 mongocrypt日志函数的回调。使用 mongocrypt_setopt_log_handler 方法设置自定义日志回调
294 |
# File 'lib/ Mongo/crypt/bounding.rb', line 294 callback :mongocrypt_log_fn_t, %i[log_level 字符串 int 指针], :void |
# mongocrypt_random_fn (ctx, output, count, status) ⇒ Bool
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
这定义了 FFI回调的方法签名;它不是 Binding 类的实例方法。
对加密安全随机函数的回调。
1314 |
# File 'lib/ Mongo/crypt/bounding.rb', line 1314 callback :mongocrypt_random_fn, %i[指针 指针 int 指针], :bool |