Class: Mongo::Crypt::DataKeyContext Private

Inherits:
Context
  • Object
show all
Defined in:
build/ruby-driver-master/lib/mongo/crypt/data_key_context.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 Context object initialized specifically for the purpose of creating a data key in the key management system.

Instance Attribute Summary

Attributes inherited from Context

#ctx_p

Instance Method Summary collapse

Methods inherited from Context

#run_state_machine, #state

Constructor Details

#initialize(mongocrypt, io, master_key_document, key_alt_names = nil) ⇒ DataKeyContext

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 DataKeyContext object

Parameters:

  • mongocrypt (Mongo::Crypt::Handle)

    a Handle that wraps a mongocrypt_t object used to create a new mongocrypt_ctx_t

  • io (Mongo::Crypt::EncryptionIO)

    An object that performs all driver I/O on behalf of libmongocrypt

  • master_key_document (Mongo::Crypt::KMS::MasterKeyDocument)

    The master key document that contains master encryption key parameters.

  • key_alt_names (Array<String> | nil) (defaults to: nil)

    An optional array of strings specifying alternate names for the new data key.



37
38
39
40
41
42
# File 'build/ruby-driver-master/lib/mongo/crypt/data_key_context.rb', line 37

def initialize(mongocrypt, io, master_key_document, key_alt_names = nil)
  super(mongocrypt, io)
  Binding.ctx_setopt_key_encryption_key(self, master_key_document.to_document)
  set_key_alt_names(key_alt_names) if key_alt_names
  initialize_ctx
end