lib/mongo/crypt/encryption_io.rb
def feed_kms(kms_context)
        with_ssl_socket(kms_context.endpoint) do |ssl_socket|

          Timeout.timeout(SOCKET_TIMEOUT, Error::SocketTimeoutError,
            'Socket write operation timed out'
          ) do
            ssl_socket.syswrite(kms_context.message)
          end

          bytes_needed = kms_context.bytes_needed
          while bytes_needed > 0 do
            bytes = Timeout.timeout(SOCKET_TIMEOUT, Error::SocketTimeoutError,
              'Socket read operation timed out'
            ) do
              ssl_socket.sysread(bytes_needed)
            end

            kms_context.feed(bytes)
            bytes_needed = kms_context.bytes_needed
          end
        end
      end
# Get information about the AWS encryption key and feed it to the the
# KmsContext object
#
# @param [ Mongo::Crypt::KmsContext ] kms_context A KmsContext object
#   corresponding to one AWS KMS data key. Contains information about
#   the endpoint at which to establish a TLS connection and the message
#   to send on that connection.
Get information about the AWS encryption key and feed it to the the
KmsContext object
Get information about the AWS encryption key and feed it to the the KmsContext object
def feed_kms(kms_context)
        with_ssl_socket(kms_context.endpoint) do |ssl_socket|
          Timeout.timeout(SOCKET_TIMEOUT, Error::SocketTimeoutError,
            'Socket write operation timed out'
          ) do
            ssl_socket.syswrite(kms_context.message)
          end
          bytes_needed = kms_context.bytes_needed
          while bytes_needed > 0 do
            bytes = Timeout.timeout(SOCKET_TIMEOUT, Error::SocketTimeoutError,
              'Socket read operation timed out'
            ) do
              ssl_socket.sysread(bytes_needed)
            end
            kms_context.feed(bytes)
            bytes_needed = kms_context.bytes_needed
          end
        end
      end
def feed_kms ( kms_context ) with_ssl_socket ( kms_context . endpoint ) do | ssl_socket | Timeout . timeout ( SOCKET_TIMEOUT , Error :: SocketTimeoutError , 'Socket write operation timed out' ) do ssl_socket . syswrite ( kms_context . message ) end bytes_needed = kms_context . bytes_needed while bytes_needed > 0 do bytes = Timeout . timeout ( SOCKET_TIMEOUT , Error :: SocketTimeoutError , 'Socket read operation timed out' ) do ssl_socket . sysread ( bytes_needed ) end kms_context . feed ( bytes ) bytes_needed = kms_context . bytes_needed end end end
Get information about the AWS encryption key and feed it to the the
KmsContext object
Get information about the AWS encryption key and feed it to the the KmsContext object
kms_context
kms_context A KmsContext object corresponding to one AWS KMS data key. Contains information about the endpoint at which to establish a TLS connection and the message to send on that connection.
kms_context A KmsContext object corresponding to one AWS KMS data key . Contains information about the endpoint at which to establish a TLS connection and the message to send on that connection .