Method: Sequel::Plugins::ColumnEncryption::Cryptor#initialize
- Defined in:
- lib/sequel/plugins/column_encryption.rb
permalink #initialize(keys) ⇒ Cryptor
Keys should be an array of arrays containing key_id, key string, auth_data, and padding.
357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 |
# File 'lib/sequel/plugins/column_encryption.rb', line 357 def initialize(keys) if !keys || keys.empty? raise Error, "Cannot initialize encryptor without encryption key" end # First key is used for encryption @key_id, @key, @auth_data, @padding = keys[0] # All keys are candidates for decryption @key_map = {} keys.each do |key_id, key, auth_data, padding| @key_map[key_id] = [key, auth_data, padding].freeze end freeze end |