lib/asherah.rb
# Encrypts data for a given partition_id and returns DataRowRecord in JSON format.
#
# DataRowRecord contains the encrypted key and data, as well as the information
# required to decrypt the key encryption key. This object data should be stored
# in your data persistence as it's required to decrypt data.
#
# EnvelopeKeyRecord represents an encrypted key and is the data structure used
# to persist the key in the key table. It also contains the meta data
# of the key used to encrypt it.
#
# KeyMeta contains the `id` and `created` timestamp for an encryption key.
#
# @param partition_id [String]
# @param data [String]
# @return [String], DataRowRecord in JSON format
Encrypts data for a given partition_id and returns DataRowRecord in JSON format.
DataRowRecord contains the encrypted key and data, as well as the information
required to decrypt the key encryption key. This object data should be stored
in your data persistence as it's required to decrypt data.

EnvelopeKeyRecord represents an encrypted key and is the data structure used
to persist the key in the key table. It also contains the meta data
of the key used to encrypt it.

KeyMeta contains the `id` and `created` timestamp for an encryption key.
Encrypts data for a given partition_id and returns DataRowRecord in JSON format . DataRowRecord contains the encrypted key and data as well as the information required to decrypt the key encryption key . This object data should be stored in your data persistence as it ' s required to decrypt data . EnvelopeKeyRecord represents an encrypted key and is the data structure used to persist the key in the key table . It also contains the meta data of the key used to encrypt it . KeyMeta contains the ` id ` and ` created ` timestamp for an encryption key .
def encrypt(partition_id, data)
      partition_id_buffer = string_to_cbuffer(partition_id)
      data_buffer = string_to_cbuffer(data)
      estimated_buffer_bytesize = estimate_buffer(data.bytesize, partition_id.bytesize)
      output_buffer = allocate_cbuffer(estimated_buffer_bytesize)
      result = EncryptToJson(partition_id_buffer, data_buffer, output_buffer)
      Error.check_result!(result, 'EncryptToJson failed')
      cbuffer_to_string(output_buffer)
    ensure
      [partition_id_buffer, data_buffer, output_buffer].map(&:free)
    end
def encrypt ( partition_id , data ) partition_id_buffer = string_to_cbuffer ( partition_id ) data_buffer = string_to_cbuffer ( data ) estimated_buffer_bytesize = estimate_buffer ( data . bytesize , partition_id . bytesize ) output_buffer = allocate_cbuffer ( estimated_buffer_bytesize ) result = EncryptToJson ( partition_id_buffer , data_buffer , output_buffer ) Error . check_result! ( result , 'EncryptToJson failed' ) cbuffer_to_string ( output_buffer ) ensure [ partition_id_buffer , data_buffer , output_buffer ] . map ( & :free ) end
Encrypts data for a given partition_id and returns DataRowRecord in JSON format.
Encrypts data for a given partition_id and returns DataRowRecord in JSON format .
, DataRowRecord in JSON format
DataRowRecord in JSON format
String
partition_id
data
None