Class: Mongo::Crypt::Binding Private
- Inherits:
-
Object
- Object
- Mongo::Crypt::Binding
- Extended by:
- FFI::Library
- Defined in:
- lib/mongo/crypt/binding.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
A Ruby binding for the libmongocrypt C library
Class Method Summary collapse
-
.check_ctx_status(context) ⇒ nil
private
Raise a Mongo::Error::CryptError based on the status of the underlying mongocrypt_ctx_t object.
-
.check_kms_ctx_status(kms_context) ⇒ Object
private
If the provided block returns false, raise a CryptError with the status information from the provided KmsContext object.
-
.check_status(handle) ⇒ nil
private
Raise a Mongo::Error::CryptError based on the status of the underlying mongocrypt_t object.
-
.ctx_datakey_init(context) ⇒ Object
private
Initialize the Context to create a data key.
-
.ctx_decrypt_init(context, command) ⇒ Object
private
Initialize the Context for auto-decryption.
-
.ctx_encrypt_init(context, db_name, command) ⇒ Object
private
Initialize the Context for auto-encryption.
-
.ctx_explicit_decrypt_init(context, doc) ⇒ Object
private
Initialize the Context for explicit decryption.
-
.ctx_explicit_encrypt_init(context, doc) ⇒ Object
private
Initialize the Context for explicit encryption.
-
.ctx_finalize(context) ⇒ Object
private
Finalize the state machine represented by the Context.
-
.ctx_kms_done(context) ⇒ Object
private
Indicate to libmongocrypt that it will receive no more KMS replies.
-
.ctx_mongo_feed(context, doc) ⇒ Object
private
Feed a response from the driver back to libmongocrypt.
-
.ctx_mongo_op(context) ⇒ BSON::Document
private
Returns a BSON::Document representing an operation that the driver must perform on behalf of libmongocrypt to get the information it needs in order to continue with encryption/decryption (for example, a filter for a key vault query).
-
.ctx_next_kms_ctx(context) ⇒ Mongo::Crypt::KmsContext | nil
private
Return a new KmsContext object needed by a Context object.
-
.ctx_setopt_algorithm(context, name) ⇒ Object
private
Set the algorithm on the context.
-
.ctx_setopt_key_alt_names(context, key_alt_names) ⇒ Object
private
Set multiple alternate key names on data key creation.
-
.ctx_setopt_key_id(context, key_id) ⇒ Object
private
Sets the key id option on an explicit encryption context.
-
.ctx_setopt_master_key_aws(context, region, arn) ⇒ Object
private
Configure the Context object to take a master key from AWS.
-
.ctx_setopt_master_key_aws_endpoint(context, endpoint) ⇒ Object
private
Configure the Context object to take a masterk ey from AWS.
-
.ctx_setopt_master_key_local(context) ⇒ Object
private
Tell the Context object to read the master key from local KMS options.
-
.init(handle) ⇒ Object
private
Initialize the Mongo::Crypt::Handle object.
-
.kms_ctx_bytes_needed(kms_context) ⇒ Integer
private
Get the number of bytes needed by the KmsContext.
-
.kms_ctx_endpoint(kms_context) ⇒ String | nil
private
Get the hostname with which to connect over TLS to get information about the AWS master key.
-
.kms_ctx_feed(kms_context, bytes) ⇒ Object
private
Feed replies from the KMS back to libmongocrypt.
-
.kms_ctx_message(kms_context) ⇒ String
private
Get the HTTP message needed to fetch the AWS KMS master key from a KmsContext object.
-
.mongocrypt_binary_data(binary) ⇒ FFI::Pointer
private
Get the pointer to the underlying data for the mongocrypt_binary_t.
-
.mongocrypt_binary_destroy(binary) ⇒ nil
private
Destroy the mongocrypt_binary_t object.
-
.mongocrypt_binary_len(binary) ⇒ Integer
private
Get the length of the underlying data array.
-
.mongocrypt_binary_new ⇒ FFI::Pointer
private
Creates a new mongocrypt_binary_t object (a non-owning view of a byte array).
-
.mongocrypt_binary_new_from_data(data, len) ⇒ FFI::Pointer
private
Create a new mongocrypt_binary_t object that maintains a pointer to the specified byte array.
-
.mongocrypt_ctx_datakey_init(ctx) ⇒ Boolean
private
Initializes the ctx to create a data key.
-
.mongocrypt_ctx_decrypt_init(ctx, doc) ⇒ Boolean
private
Initializes the ctx for auto-decryption.
-
.mongocrypt_ctx_destroy(ctx) ⇒ nil
private
Destroy the reference to the mongocrypt_ctx_t object.
-
.mongocrypt_ctx_encrypt_init(ctx, db, db_len, cmd) ⇒ Boolean
private
Initializes the ctx for auto-encryption.
-
.mongocrypt_ctx_explicit_decrypt_init(ctx, msg) ⇒ Boolean
private
Initializes the ctx for explicit decryption.
-
.mongocrypt_ctx_explicit_encrypt_init(ctx, msg) ⇒ Boolean
private
Initializes the ctx for explicit encryption.
-
.mongocrypt_ctx_finalize(ctx, op_bson) ⇒ Boolean
private
Perform the final encryption or decryption and return a BSON document.
-
.mongocrypt_ctx_mongo_done(ctx) ⇒ Boolean
private
Indicate to libmongocrypt that the driver is done feeding replies.
-
.mongocrypt_ctx_mongo_feed(ctx, reply) ⇒ Boolean
private
Feed a BSON reply to libmongocrypt.
-
.mongocrypt_ctx_mongo_next_kms_ctx(ctx) ⇒ FFI::Pointer
private
Return a pointer to a mongocrypt_kms_ctx_t object or NULL.
-
.mongocrypt_ctx_mongo_op(ctx, op_bson) ⇒ Boolean
private
Get a BSON operation for the driver to run against the MongoDB collection, the key vault database, or mongocryptd.
-
.mongocrypt_ctx_new(crypt) ⇒ FFI::Pointer
private
Create a new mongocrypt_ctx_t object (a wrapper for the libmongocrypt state machine).
-
.mongocrypt_ctx_setopt_algorithm(ctx, algorithm, len) ⇒ Boolean
private
Set the algorithm used for explicit encryption.
-
.mongocrypt_ctx_setopt_key_alt_name(ctx, binary) ⇒ Boolean
private
When creating a data key, set an alternate name on that key.
-
.mongocrypt_ctx_setopt_key_id(ctx, key_id) ⇒ Boolean
private
Set the key id used for explicit encryption.
-
.mongocrypt_ctx_setopt_masterkey_aws(ctx, region, region_len, arn, arn_len) ⇒ Boolean
private
Configure the ctx to take a master key from AWS.
-
.mongocrypt_ctx_setopt_masterkey_aws_endpoint(ctx, endpoint, endpoint_len) ⇒ Boolean
private
Set a custom endpoint at which to fetch the AWS master key.
-
.mongocrypt_ctx_setopt_masterkey_local(ctx) ⇒ Boolean
private
Set the ctx to take a local master key.
-
.mongocrypt_ctx_state(ctx) ⇒ Symbol
private
Get the current state of the ctx.
-
.mongocrypt_ctx_status(ctx, status) ⇒ Boolean
private
Set the status information from the mongocrypt_ctx_t object on the mongocrypt_status_t object.
-
.mongocrypt_destroy(crypt) ⇒ nil
private
Destroy the reference the mongocrypt_t object.
-
.mongocrypt_init(crypt) ⇒ Boolean
private
Initialize the mongocrypt_t object.
-
.mongocrypt_kms_ctx_bytes_needed(kms) ⇒ Integer
private
Get the number of bytes needed by the KMS context.
-
.mongocrypt_kms_ctx_done(ctx) ⇒ Boolean
private
Indicate to libmongocrypt that it will receive no more replies from mongocrypt_kms_ctx_t objects.
-
.mongocrypt_kms_ctx_endpoint(kms, endpoint) ⇒ Boolean
private
Get the hostname with which to connect over TLS to get information about the AWS master key.
-
.mongocrypt_kms_ctx_feed(kms, bytes) ⇒ Boolean
private
Feed replies from the KMS back to libmongocrypt.
-
.mongocrypt_kms_ctx_message(kms, msg) ⇒ Boolean
private
Get the message needed to fetch the AWS KMS master key.
-
.mongocrypt_kms_ctx_status(kms, status) ⇒ Boolean
private
Write status information about the mongocrypt_kms_ctx_t object to the mongocrypt_status_t object.
-
.mongocrypt_setopt_crypto_hooks(crypt, aes_enc_fn, aes_dec_fn, random_fn, sha_512_fn, sha_256_fn, hash_fn, ctx = nil) ⇒ Boolean
private
Set crypto hooks on the provided mongocrypt object.
-
.mongocrypt_setopt_kms_provider_aws(crypt, aws_access_key_id, aws_access_key_id_len, aws_secret_access_key, aws_secret_access_key_len) ⇒ Boolean
private
Configure mongocrypt_t object with AWS KMS provider options.
-
.mongocrypt_setopt_kms_provider_local(crypt, key) ⇒ Boolean
private
Configure mongocrypt_t object to take local KSM provider options.
-
.mongocrypt_setopt_log_handler(crypt, log_fn, log_ctx = nil) ⇒ Boolean
private
Set the handler on the mongocrypt_t object to be called every time libmongocrypt logs a message.
-
.mongocrypt_setopt_schema_map(crypt, schema_map) ⇒ Boolean
private
Sets a local schema map for encryption.
-
.mongocrypt_status(crypt, status) ⇒ Boolean
private
Set the status information from the mongocrypt_t object on the mongocrypt_status_t object.
-
.mongocrypt_status_code(status) ⇒ Integer
private
Return the status error code.
-
.mongocrypt_status_destroy(status) ⇒ nil
private
Destroys the reference to the mongocrypt_status_t object.
-
.mongocrypt_status_message(status, len = nil) ⇒ String
private
Returns the status message.
-
.mongocrypt_status_new ⇒ FFI::Pointer
private
Create a new mongocrypt_status_t object.
-
.mongocrypt_status_ok(status) ⇒ Boolean
private
Returns whether the status is ok or an error.
-
.mongocrypt_status_set(status, type, code, message, len) ⇒ nil
private
Set a message, type, and code on an existing status.
-
.mongocrypt_status_type(status) ⇒ Symbol
private
Indicates the status type.
-
.mongocrypt_version(len) ⇒ String
private
Returns the version string of the libmongocrypt library.
-
.ongocrypt_new ⇒ FFI::Pointer
private
Creates a new mongocrypt_t object.
-
.setopt_crypto_hooks(handle, aes_encrypt_cb, aes_decrypt_cb, random_cb, hmac_sha_512_cb, hmac_sha_256_cb, hmac_hash_cb) ⇒ Object
private
Set crypto callbacks on the Handle.
-
.setopt_kms_provider_aws(handle, aws_access_key, aws_secret_access_key) ⇒ Object
private
Configure the Handle object with AWS KMS provider options.
-
.setopt_kms_provider_local(handle, master_key) ⇒ Object
private
Set local KMS provider options on the Mongo::Crypt::Handle object.
-
.setopt_log_handler(handle, log_callback) ⇒ Object
private
Set the logger callback function on the Mongo::Crypt::Handle object.
-
.setopt_schema_map(handle, schema_map_doc) ⇒ Object
private
Set schema map on the Mongo::Crypt::Handle object.
-
.validate_document(data) ⇒ Object
private
Checks that the specified data is a Hash before serializing it to BSON to prevent errors from libmongocrypt.
Instance Method Summary collapse
-
#mongocrypt_crypto_fn(ctx, key, iv, input, output, status) ⇒ Bool
private
A callback to a function that performs AES encryption or decryption.
-
#mongocrypt_hash_fn(ctx, input, output, status) ⇒ Bool
private
A callback to a SHA-256 hash function.
-
#mongocrypt_hmac_fn(ctx, key, input, output, status) ⇒ Bool
private
A callback to a function that performs HMAC SHA-512 or SHA-256.
-
#mongocrypt_log_fn_t(level, message, len, ctx) ⇒ nil
private
A callback to the mongocrypt log function.
-
#mongocrypt_random_fn(ctx, output, count, status) ⇒ Bool
private
A callback to a crypto secure random function.
Class Method Details
.check_ctx_status(context) ⇒ nil
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Raise a Mongo::Error::CryptError based on the status of the underlying mongocrypt_ctx_t object.
1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 |
# File 'lib/mongo/crypt/binding.rb', line 1191 def self.check_ctx_status(context) if block_given? do_raise = !yield else do_raise = true end if do_raise status = Status.new mongocrypt_ctx_status(context.ctx_p, status.ref) status.raise_crypt_error end end |
.check_kms_ctx_status(kms_context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
If the provided block returns false, raise a CryptError with the status information from the provided KmsContext object.
966 967 968 969 970 971 972 973 |
# File 'lib/mongo/crypt/binding.rb', line 966 def self.check_kms_ctx_status(kms_context) unless yield status = Status.new mongocrypt_kms_ctx_status(kms_context.kms_ctx_p, status.ref) status.raise_crypt_error end end |
.check_status(handle) ⇒ nil
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Raise a Mongo::Error::CryptError based on the status of the underlying mongocrypt_t object.
1178 1179 1180 1181 1182 1183 1184 1185 |
# File 'lib/mongo/crypt/binding.rb', line 1178 def self.check_status(handle) unless yield status = Status.new mongocrypt_status(handle.ref, status.ref) status.raise_crypt_error end end |
.ctx_datakey_init(context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize the Context to create a data key
605 606 607 608 609 |
# File 'lib/mongo/crypt/binding.rb', line 605 def self.ctx_datakey_init(context) check_ctx_status(context) do mongocrypt_ctx_datakey_init(context.ctx_p) end end |
.ctx_decrypt_init(context, command) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize the Context for auto-decryption
698 699 700 701 702 703 704 705 706 |
# File 'lib/mongo/crypt/binding.rb', line 698 def self.ctx_decrypt_init(context, command) validate_document(command) data = command.to_bson.to_s Binary.wrap_string(data) do |data_p| check_ctx_status(context) do mongocrypt_ctx_decrypt_init(context.ctx_p, data_p) end end end |
.ctx_encrypt_init(context, db_name, command) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize the Context for auto-encryption
638 639 640 641 642 643 644 645 646 |
# File 'lib/mongo/crypt/binding.rb', line 638 def self.ctx_encrypt_init(context, db_name, command) validate_document(command) data = command.to_bson.to_s Binary.wrap_string(data) do |data_p| check_ctx_status(context) do mongocrypt_ctx_encrypt_init(context.ctx_p, db_name, -1, data_p) end end end |
.ctx_explicit_decrypt_init(context, doc) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize the Context for explicit decryption
728 729 730 731 732 733 734 735 736 |
# File 'lib/mongo/crypt/binding.rb', line 728 def self.ctx_explicit_decrypt_init(context, doc) validate_document(doc) data = doc.to_bson.to_s Binary.wrap_string(data) do |data_p| check_ctx_status(context) do mongocrypt_ctx_explicit_decrypt_init(context.ctx_p, data_p) end end end |
.ctx_explicit_encrypt_init(context, doc) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize the Context for explicit encryption
672 673 674 675 676 677 678 679 680 |
# File 'lib/mongo/crypt/binding.rb', line 672 def self.ctx_explicit_encrypt_init(context, doc) validate_document(doc) data = doc.to_bson.to_s Binary.wrap_string(data) do |data_p| check_ctx_status(context) do mongocrypt_ctx_explicit_encrypt_init(context.ctx_p, data_p) end end end |
.ctx_finalize(context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Finalize the state machine represented by the Context
1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 |
# File 'lib/mongo/crypt/binding.rb', line 1012 def self.ctx_finalize(context) binary = Binary.new check_ctx_status(context) do mongocrypt_ctx_finalize(context.ctx_p, binary.ref) end # TODO since the binary references a C pointer, and ByteBuffer is # written in C in MRI, we could omit a copy of the data by making # ByteBuffer reference the string that is owned by libmongocrypt. BSON::Document.from_bson(BSON::ByteBuffer.new(binary.to_s), mode: :bson) end |
.ctx_kms_done(context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Indicate to libmongocrypt that it will receive no more KMS replies.
989 990 991 992 993 |
# File 'lib/mongo/crypt/binding.rb', line 989 def self.ctx_kms_done(context) check_ctx_status(context) do mongocrypt_ctx_kms_done(context.ctx_p) end end |
.ctx_mongo_feed(context, doc) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Feed a response from the driver back to libmongocrypt
808 809 810 811 812 813 814 815 816 |
# File 'lib/mongo/crypt/binding.rb', line 808 def self.ctx_mongo_feed(context, doc) validate_document(doc) data = doc.to_bson.to_s Binary.wrap_string(data) do |data_p| check_ctx_status(context) do mongocrypt_ctx_mongo_feed(context.ctx_p, data_p) end end end |
.ctx_mongo_op(context) ⇒ BSON::Document
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a BSON::Document representing an operation that the driver must perform on behalf of libmongocrypt to get the information it needs in order to continue with encryption/decryption (for example, a filter for a key vault query).
779 780 781 782 783 784 785 786 787 788 789 790 |
# File 'lib/mongo/crypt/binding.rb', line 779 def self.ctx_mongo_op(context) binary = Binary.new check_ctx_status(context) do mongocrypt_ctx_mongo_op(context.ctx_p, binary.ref) end # TODO since the binary references a C pointer, and ByteBuffer is # written in C in MRI, we could omit a copy of the data by making # ByteBuffer reference the string that is owned by libmongocrypt. BSON::Document.from_bson(BSON::ByteBuffer.new(binary.to_s), mode: :bson) end |
.ctx_next_kms_ctx(context) ⇒ Mongo::Crypt::KmsContext | nil
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return a new KmsContext object needed by a Context object.
840 841 842 843 844 845 846 847 848 |
# File 'lib/mongo/crypt/binding.rb', line 840 def self.ctx_next_kms_ctx(context) kms_ctx_p = mongocrypt_ctx_next_kms_ctx(context.ctx_p) if kms_ctx_p.null? nil else KmsContext.new(kms_ctx_p) end end |
.ctx_setopt_algorithm(context, name) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Set the algorithm on the context
490 491 492 493 494 |
# File 'lib/mongo/crypt/binding.rb', line 490 def self.ctx_setopt_algorithm(context, name) check_ctx_status(context) do mongocrypt_ctx_setopt_algorithm(context.ctx_p, name, -1) end end |
.ctx_setopt_key_alt_names(context, key_alt_names) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Set multiple alternate key names on data key creation
453 454 455 456 457 458 459 460 461 462 463 |
# File 'lib/mongo/crypt/binding.rb', line 453 def self.ctx_setopt_key_alt_names(context, key_alt_names) key_alt_names.each do |key_alt_name| key_alt_name_bson = { :keyAltName => key_alt_name }.to_bson.to_s Binary.wrap_string(key_alt_name_bson) do |key_alt_name_p| check_ctx_status(context) do mongocrypt_ctx_setopt_key_alt_name(context.ctx_p, key_alt_name_p) end end end end |
.ctx_setopt_key_id(context, key_id) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Sets the key id option on an explicit encryption context.
420 421 422 423 424 425 426 |
# File 'lib/mongo/crypt/binding.rb', line 420 def self.ctx_setopt_key_id(context, key_id) Binary.wrap_string(key_id) do |key_id_p| check_ctx_status(context) do mongocrypt_ctx_setopt_key_id(context.ctx_p, key_id_p) end end end |
.ctx_setopt_master_key_aws(context, region, arn) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Configure the Context object to take a master key from AWS
521 522 523 524 525 526 527 528 529 530 531 |
# File 'lib/mongo/crypt/binding.rb', line 521 def self.ctx_setopt_master_key_aws(context, region, arn) check_ctx_status(context) do mongocrypt_ctx_setopt_masterkey_aws( context.ctx_p, region, -1, arn, -1 ) end end |
.ctx_setopt_master_key_aws_endpoint(context, endpoint) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Configure the Context object to take a masterk ey from AWS
554 555 556 557 558 559 560 561 562 |
# File 'lib/mongo/crypt/binding.rb', line 554 def self.ctx_setopt_master_key_aws_endpoint(context, endpoint) check_ctx_status(context) do mongocrypt_ctx_setopt_masterkey_aws_endpoint( context.ctx_p, endpoint, -1, ) end end |
.ctx_setopt_master_key_local(context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Tell the Context object to read the master key from local KMS options
582 583 584 585 586 |
# File 'lib/mongo/crypt/binding.rb', line 582 def self.ctx_setopt_master_key_local(context) check_ctx_status(context) do mongocrypt_ctx_setopt_masterkey_local(context.ctx_p) end end |
.init(handle) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize the Mongo::Crypt::Handle object
360 361 362 363 364 |
# File 'lib/mongo/crypt/binding.rb', line 360 def self.init(handle) check_status(handle) do mongocrypt_init(handle.ref) end end |
.kms_ctx_bytes_needed(kms_context) ⇒ Integer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Get the number of bytes needed by the KmsContext.
922 923 924 |
# File 'lib/mongo/crypt/binding.rb', line 922 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
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Get the hostname with which to connect over TLS to get information about the AWS master key.
898 899 900 901 902 903 904 905 906 907 |
# File 'lib/mongo/crypt/binding.rb', line 898 def self.kms_ctx_endpoint(kms_context) ptr = FFI::MemoryPointer.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_feed(kms_context, bytes) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Feed replies from the KMS back to libmongocrypt.
942 943 944 945 946 947 948 |
# File 'lib/mongo/crypt/binding.rb', line 942 def self.kms_ctx_feed(kms_context, bytes) check_kms_ctx_status(kms_context) do Binary.wrap_string(bytes) do |bytes_p| mongocrypt_kms_ctx_feed(kms_context.kms_ctx_p, bytes_p) end end end |
.kms_ctx_message(kms_context) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Get the HTTP message needed to fetch the AWS KMS master key from a KmsContext object.
869 870 871 872 873 874 875 876 877 |
# File 'lib/mongo/crypt/binding.rb', line 869 def self.(kms_context) binary = Binary.new check_kms_ctx_status(kms_context) do (kms_context.kms_ctx_p, binary.ref) end return binary.to_s end |
.mongocrypt_binary_data(binary) ⇒ FFI::Pointer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Get the pointer to the underlying data for the mongocrypt_binary_t.
99 |
# File 'lib/mongo/crypt/binding.rb', line 99 attach_function :mongocrypt_binary_data, [:pointer], :pointer |
.mongocrypt_binary_destroy(binary) ⇒ nil
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Destroy the mongocrypt_binary_t object.
115 |
# File 'lib/mongo/crypt/binding.rb', line 115 attach_function :mongocrypt_binary_destroy, [:pointer], :void |
.mongocrypt_binary_len(binary) ⇒ Integer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Get the length of the underlying data array.
107 |
# File 'lib/mongo/crypt/binding.rb', line 107 attach_function :mongocrypt_binary_len, [:pointer], :int |
.mongocrypt_binary_new ⇒ FFI::Pointer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Creates a new mongocrypt_binary_t object (a non-owning view of a byte
array).
75 |
# File 'lib/mongo/crypt/binding.rb', line 75 attach_function :mongocrypt_binary_new, [], :pointer |
.mongocrypt_binary_new_from_data(data, len) ⇒ FFI::Pointer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Create a new mongocrypt_binary_t object that maintains a pointer to
the specified byte array.
87 88 89 90 91 |
# File 'lib/mongo/crypt/binding.rb', line 87 attach_function( :mongocrypt_binary_new_from_data, [:pointer, :int], :pointer ) |
.mongocrypt_ctx_datakey_init(ctx) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Before calling this method, master key options must be set. Set AWS master key by calling mongocrypt_ctx_setopt_masterkey_aws and mongocrypt_ctx_setopt_masterkey_aws_endpoint. Set local master key by calling mongocrypt_ctx_setopt_masterkey_local.
Initializes the ctx to create a data key.
598 |
# File 'lib/mongo/crypt/binding.rb', line 598 attach_function :mongocrypt_ctx_datakey_init, [:pointer], :bool |
.mongocrypt_ctx_decrypt_init(ctx, doc) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initializes the ctx for auto-decryption.
690 |
# File 'lib/mongo/crypt/binding.rb', line 690 attach_function :mongocrypt_ctx_decrypt_init, [:pointer, :pointer], :bool |
.mongocrypt_ctx_destroy(ctx) ⇒ nil
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Destroy the reference to the mongocrypt_ctx_t object.
1031 |
# File 'lib/mongo/crypt/binding.rb', line 1031 attach_function :mongocrypt_ctx_destroy, [:pointer], :void |
.mongocrypt_ctx_encrypt_init(ctx, db, db_len, cmd) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method expects the passed-in BSON to be in the format: { “v”: BSON value to decrypt }.
Initializes the ctx for auto-encryption.
624 625 626 627 628 |
# File 'lib/mongo/crypt/binding.rb', line 624 attach_function( :mongocrypt_ctx_encrypt_init, [:pointer, :string, :int, :pointer], :bool ) |
.mongocrypt_ctx_explicit_decrypt_init(ctx, msg) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initializes the ctx for explicit decryption.
716 717 718 719 720 |
# File 'lib/mongo/crypt/binding.rb', line 716 attach_function( :mongocrypt_ctx_explicit_decrypt_init, [:pointer, :pointer], :bool ) |
.mongocrypt_ctx_explicit_encrypt_init(ctx, msg) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Before calling this method, set a key_id, key_alt_name (optional), and encryption algorithm using the following methods: mongocrypt_ctx_setopt_key_id, mongocrypt_ctx_setopt_key_alt_name, and mongocrypt_ctx_setopt_algorithm.
Initializes the ctx for explicit encryption.
660 661 662 663 664 |
# File 'lib/mongo/crypt/binding.rb', line 660 attach_function( :mongocrypt_ctx_explicit_encrypt_init, [:pointer, :pointer], :bool ) |
.mongocrypt_ctx_finalize(ctx, op_bson) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Perform the final encryption or decryption and return a BSON document.
1004 |
# File 'lib/mongo/crypt/binding.rb', line 1004 attach_function :mongocrypt_ctx_finalize, [:pointer, :pointer], :void |
.mongocrypt_ctx_mongo_done(ctx) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Indicate to libmongocrypt that the driver is done feeding replies.
824 |
# File 'lib/mongo/crypt/binding.rb', line 824 attach_function :mongocrypt_ctx_mongo_done, [:pointer], :bool |
.mongocrypt_ctx_mongo_feed(ctx, reply) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Feed a BSON reply to libmongocrypt.
800 |
# File 'lib/mongo/crypt/binding.rb', line 800 attach_function :mongocrypt_ctx_mongo_feed, [:pointer, :pointer], :bool |
.mongocrypt_ctx_mongo_next_kms_ctx(ctx) ⇒ FFI::Pointer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return a pointer to a mongocrypt_kms_ctx_t object or NULL.
832 |
# File 'lib/mongo/crypt/binding.rb', line 832 attach_function :mongocrypt_ctx_next_kms_ctx, [:pointer], :pointer |
.mongocrypt_ctx_mongo_op(ctx, op_bson) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Get a BSON operation for the driver to run against the MongoDB
collection, the key vault database, or mongocryptd.
768 |
# File 'lib/mongo/crypt/binding.rb', line 768 attach_function :mongocrypt_ctx_mongo_op, [:pointer, :pointer], :bool |
.mongocrypt_ctx_new(crypt) ⇒ FFI::Pointer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Create a new mongocrypt_ctx_t object (a wrapper for the libmongocrypt
state machine).
391 |
# File 'lib/mongo/crypt/binding.rb', line 391 attach_function :mongocrypt_ctx_new, [:pointer], :pointer |
.mongocrypt_ctx_setopt_algorithm(ctx, algorithm, len) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Do not initialize ctx before calling this method.
Set the algorithm used for explicit encryption.
476 477 478 479 480 |
# File 'lib/mongo/crypt/binding.rb', line 476 attach_function( :mongocrypt_ctx_setopt_algorithm, [:pointer, :string, :int], :bool ) |
.mongocrypt_ctx_setopt_key_alt_name(ctx, binary) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Do not initialize ctx before calling this method.
When creating a data key, set an alternate name on that key. When
performing explicit encryption, which data key to use for
encryption based on its keyAltName field.
440 441 442 443 444 |
# File 'lib/mongo/crypt/binding.rb', line 440 attach_function( :mongocrypt_ctx_setopt_key_alt_name, [:pointer, :pointer], :bool ) |
.mongocrypt_ctx_setopt_key_id(ctx, key_id) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Do not initialize ctx before calling this method.
Set the key id used for explicit encryption.
412 |
# File 'lib/mongo/crypt/binding.rb', line 412 attach_function :mongocrypt_ctx_setopt_key_id, [:pointer, :pointer], :bool |
.mongocrypt_ctx_setopt_masterkey_aws(ctx, region, region_len, arn, arn_len) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Configure the ctx to take a master key from AWS.
508 509 510 511 512 |
# File 'lib/mongo/crypt/binding.rb', line 508 attach_function( :mongocrypt_ctx_setopt_masterkey_aws, [:pointer, :string, :int, :string, :int], :bool ) |
.mongocrypt_ctx_setopt_masterkey_aws_endpoint(ctx, endpoint, endpoint_len) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Set a custom endpoint at which to fetch the AWS master key
542 543 544 545 546 |
# File 'lib/mongo/crypt/binding.rb', line 542 attach_function( :mongocrypt_ctx_setopt_masterkey_aws_endpoint, [:pointer, :string, :int], :bool ) |
.mongocrypt_ctx_setopt_masterkey_local(ctx) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Do not initialize ctx before calling this method.
Set the ctx to take a local master key.
571 572 573 574 575 |
# File 'lib/mongo/crypt/binding.rb', line 571 attach_function( :mongocrypt_ctx_setopt_masterkey_local, [:pointer], :bool ) |
.mongocrypt_ctx_state(ctx) ⇒ Symbol
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Get the current state of the ctx.
756 |
# File 'lib/mongo/crypt/binding.rb', line 756 attach_function :mongocrypt_ctx_state, [:pointer], :mongocrypt_ctx_state |
.mongocrypt_ctx_status(ctx, status) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Set the status information from the mongocrypt_ctx_t object on the
mongocrypt_status_t object.
401 |
# File 'lib/mongo/crypt/binding.rb', line 401 attach_function :mongocrypt_ctx_status, [:pointer, :pointer], :bool |
.mongocrypt_destroy(crypt) ⇒ nil
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Destroy the reference the mongocrypt_t object.
382 |
# File 'lib/mongo/crypt/binding.rb', line 382 attach_function :mongocrypt_destroy, [:pointer], :void |
.mongocrypt_init(crypt) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize the mongocrypt_t object.
353 |
# File 'lib/mongo/crypt/binding.rb', line 353 attach_function :mongocrypt_init, [:pointer], :bool |
.mongocrypt_kms_ctx_bytes_needed(kms) ⇒ Integer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Get the number of bytes needed by the KMS context.
915 |
# File 'lib/mongo/crypt/binding.rb', line 915 attach_function :mongocrypt_kms_ctx_bytes_needed, [:pointer], :int |
.mongocrypt_kms_ctx_done(ctx) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Indicate to libmongocrypt that it will receive no more replies from
mongocrypt_kms_ctx_t objects.
982 |
# File 'lib/mongo/crypt/binding.rb', line 982 attach_function :mongocrypt_ctx_kms_done, [:pointer], :bool |
.mongocrypt_kms_ctx_endpoint(kms, endpoint) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Get the hostname with which to connect over TLS to get information about
the AWS master key.
888 |
# File 'lib/mongo/crypt/binding.rb', line 888 attach_function :mongocrypt_kms_ctx_endpoint, [:pointer, :pointer], :bool |
.mongocrypt_kms_ctx_feed(kms, bytes) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Feed replies from the KMS back to libmongocrypt.
934 |
# File 'lib/mongo/crypt/binding.rb', line 934 attach_function :mongocrypt_kms_ctx_feed, [:pointer, :pointer], :bool |
.mongocrypt_kms_ctx_message(kms, msg) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Get the message needed to fetch the AWS KMS master key.
859 |
# File 'lib/mongo/crypt/binding.rb', line 859 attach_function :mongocrypt_kms_ctx_message, [:pointer, :pointer], :bool |
.mongocrypt_kms_ctx_status(kms, status) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Write status information about the mongocrypt_kms_ctx_t object
to the mongocrypt_status_t object.
958 |
# File 'lib/mongo/crypt/binding.rb', line 958 attach_function :mongocrypt_kms_ctx_status, [:pointer, :pointer], :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
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Set crypto hooks on the provided mongocrypt object.
1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 |
# File 'lib/mongo/crypt/binding.rb', line 1136 attach_function( :mongocrypt_setopt_crypto_hooks, [ :pointer, :mongocrypt_crypto_fn, :mongocrypt_crypto_fn, :mongocrypt_random_fn, :mongocrypt_hmac_fn, :mongocrypt_hmac_fn, :mongocrypt_hash_fn, :pointer ], :bool ) |
.mongocrypt_setopt_kms_provider_aws(crypt, aws_access_key_id, aws_access_key_id_len, aws_secret_access_key, aws_secret_access_key_len) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Configure mongocrypt_t object with AWS KMS provider options.
265 266 267 268 269 |
# File 'lib/mongo/crypt/binding.rb', line 265 attach_function( :mongocrypt_setopt_kms_provider_aws, [:pointer, :string, :int, :string, :int], :bool ) |
.mongocrypt_setopt_kms_provider_local(crypt, key) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Configure mongocrypt_t object to take local KSM provider options.
300 301 302 303 304 |
# File 'lib/mongo/crypt/binding.rb', line 300 attach_function( :mongocrypt_setopt_kms_provider_local, [:pointer, :pointer], :bool ) |
.mongocrypt_setopt_log_handler(crypt, log_fn, log_ctx = nil) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Set the handler on the mongocrypt_t object to be called every time
libmongocrypt logs a .
235 236 237 238 239 |
# File 'lib/mongo/crypt/binding.rb', line 235 attach_function( :mongocrypt_setopt_log_handler, [:pointer, :mongocrypt_log_fn_t, :pointer], :bool ) |
.mongocrypt_setopt_schema_map(crypt, schema_map) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Sets a local schema map for encryption.
328 |
# File 'lib/mongo/crypt/binding.rb', line 328 attach_function :mongocrypt_setopt_schema_map, [:pointer, :pointer], :bool |
.mongocrypt_status(crypt, status) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Set the status information from the mongocrypt_t object on the
mongocrypt_status_t object.
374 |
# File 'lib/mongo/crypt/binding.rb', line 374 attach_function :mongocrypt_status, [:pointer, :pointer], :bool |
.mongocrypt_status_code(status) ⇒ Integer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return the status error code.
163 |
# File 'lib/mongo/crypt/binding.rb', line 163 attach_function :mongocrypt_status_code, [:pointer], :int |
.mongocrypt_status_destroy(status) ⇒ nil
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Destroys the reference to the mongocrypt_status_t object.
189 |
# File 'lib/mongo/crypt/binding.rb', line 189 attach_function :mongocrypt_status_destroy, [:pointer], :void |
.mongocrypt_status_message(status, len = nil) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the status message.
173 |
# File 'lib/mongo/crypt/binding.rb', line 173 attach_function :mongocrypt_status_message, [:pointer, :pointer], :string |
.mongocrypt_status_new ⇒ FFI::Pointer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Create a new mongocrypt_status_t object.
129 |
# File 'lib/mongo/crypt/binding.rb', line 129 attach_function :mongocrypt_status_new, [], :pointer |
.mongocrypt_status_ok(status) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns whether the status is ok or an error.
181 |
# File 'lib/mongo/crypt/binding.rb', line 181 attach_function :mongocrypt_status_ok, [:pointer], :bool |
.mongocrypt_status_set(status, type, code, message, len) ⇒ nil
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Set a message, type, and code on an existing status.
143 144 145 146 147 |
# File 'lib/mongo/crypt/binding.rb', line 143 attach_function( :mongocrypt_status_set, [:pointer, :status_type, :int, :string, :int], :void ) |
.mongocrypt_status_type(status) ⇒ Symbol
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Indicates the status type.
155 |
# File 'lib/mongo/crypt/binding.rb', line 155 attach_function :mongocrypt_status_type, [:pointer], :status_type |
.mongocrypt_version(len) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the version string of the libmongocrypt library.
66 |
# File 'lib/mongo/crypt/binding.rb', line 66 attach_function :mongocrypt_version, [:pointer], :string |
.ongocrypt_new ⇒ FFI::Pointer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Creates a new mongocrypt_t object.
223 |
# File 'lib/mongo/crypt/binding.rb', line 223 attach_function :mongocrypt_new, [], :pointer |
.setopt_crypto_hooks(handle, aes_encrypt_cb, aes_decrypt_cb, random_cb, hmac_sha_512_cb, hmac_sha_256_cb, hmac_hash_cb) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Set crypto callbacks on the Handle
1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 |
# File 'lib/mongo/crypt/binding.rb', line 1162 def self.setopt_crypto_hooks(handle, aes_encrypt_cb, aes_decrypt_cb, random_cb, hmac_sha_512_cb, hmac_sha_256_cb, hmac_hash_cb ) check_status(handle) do mongocrypt_setopt_crypto_hooks(handle.ref, aes_encrypt_cb, aes_decrypt_cb, random_cb, hmac_sha_512_cb, hmac_sha_256_cb, hmac_hash_cb, nil ) end end |
.setopt_kms_provider_aws(handle, aws_access_key, aws_secret_access_key) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Configure the Handle object with AWS KMS provider options
278 279 280 281 282 283 284 285 286 287 288 289 290 |
# File 'lib/mongo/crypt/binding.rb', line 278 def self.setopt_kms_provider_aws(handle, aws_access_key, aws_secret_access_key ) check_status(handle) do mongocrypt_setopt_kms_provider_aws( handle.ref, aws_access_key, -1, aws_secret_access_key, -1 ) end end |
.setopt_kms_provider_local(handle, master_key) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Set local KMS provider options on the Mongo::Crypt::Handle object
312 313 314 315 316 317 318 |
# File 'lib/mongo/crypt/binding.rb', line 312 def self.setopt_kms_provider_local(handle, master_key) Binary.wrap_string(master_key) do |master_key_p| check_status(handle) do mongocrypt_setopt_kms_provider_local(handle.ref, master_key_p) end end end |
.setopt_log_handler(handle, log_callback) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Set the logger callback function on the Mongo::Crypt::Handle object
247 248 249 250 251 |
# File 'lib/mongo/crypt/binding.rb', line 247 def self.setopt_log_handler(handle, log_callback) check_status(handle) do mongocrypt_setopt_log_handler(handle, log_callback, nil) end end |
.setopt_schema_map(handle, schema_map_doc) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Set schema map on the Mongo::Crypt::Handle object
337 338 339 340 341 342 343 344 345 |
# File 'lib/mongo/crypt/binding.rb', line 337 def self.setopt_schema_map(handle, schema_map_doc) validate_document(schema_map_doc) data = schema_map_doc.to_bson.to_s Binary.wrap_string(data) do |data_p| check_status(handle) do mongocrypt_setopt_schema_map(handle.ref, data_p) end end end |
.validate_document(data) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
All BSON::Document instances are also Hash instances
Checks that the specified data is a Hash before serializing it to BSON to prevent errors from libmongocrypt
1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 |
# File 'lib/mongo/crypt/binding.rb', line 1214 def self.validate_document(data) return if data.is_a?(Hash) if data.nil? = "Attempted to pass nil data to libmongocrypt. " + "Data must be a Hash" else = "Attempted to pass invalid data to libmongocrypt: #{data} " + "Data must be a Hash" end raise Error::CryptError.new() end |
Instance Method Details
#mongocrypt_crypto_fn(ctx, key, iv, input, output, status) ⇒ Bool
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This defines a method signature for an FFI callback; it is not an instance method on the Binding class.
A callback to a function that performs AES encryption or decryption.
1054 1055 1056 1057 1058 |
# File 'lib/mongo/crypt/binding.rb', line 1054 callback( :mongocrypt_crypto_fn, [:pointer, :pointer, :pointer, :pointer, :pointer, :pointer, :pointer], :bool ) |
#mongocrypt_hash_fn(ctx, input, output, status) ⇒ Bool
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This defines a method signature for an FFI callback; it is not an instance method on the Binding class.
A callback to a SHA-256 hash function.
1102 |
# File 'lib/mongo/crypt/binding.rb', line 1102 callback :mongocrypt_hash_fn, [:pointer, :pointer, :pointer, :pointer], :bool |
#mongocrypt_hmac_fn(ctx, key, input, output, status) ⇒ Bool
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This defines a method signature for an FFI callback; it is not an instance method on the Binding class.
A callback to a function that performs HMAC SHA-512 or SHA-256.
1079 1080 1081 1082 1083 |
# File 'lib/mongo/crypt/binding.rb', line 1079 callback( :mongocrypt_hmac_fn, [:pointer, :pointer, :pointer, :pointer, :pointer], :bool ) |
#mongocrypt_log_fn_t(level, message, len, ctx) ⇒ nil
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This defines a method signature for an FFI callback; it is not an instance method on the Binding class.
A callback to the mongocrypt log function. Set a custom log callback
with the mongocrypt_setopt_log_handler method
216 |
# File 'lib/mongo/crypt/binding.rb', line 216 callback :mongocrypt_log_fn_t, [:log_level, :string, :int, :pointer], :void |
#mongocrypt_random_fn(ctx, output, count, status) ⇒ Bool
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This defines a method signature for an FFI callback; it is not an instance method on the Binding class.
A callback to a crypto secure random function.
1120 |
# File 'lib/mongo/crypt/binding.rb', line 1120 callback :mongocrypt_random_fn, [:pointer, :pointer, :int, :pointer], :bool |