class Chef::EncryptedDataBagItem::Decryptor::Version3Decryptor

Public Class Methods

new(encrypted_data, key) click to toggle source
# File lib/chef/encrypted_data_bag_item/decryptor.rb, line 201
def initialize(encrypted_data, key)
  super
  assert_aead_requirements_met!(algorithm)
end

Public Instance Methods

algorithm() click to toggle source

Returns the used decryption algorithm

# File lib/chef/encrypted_data_bag_item/decryptor.rb, line 207
def algorithm
  AEAD_ALGORITHM
end
auth_tag() click to toggle source
# File lib/chef/encrypted_data_bag_item/decryptor.rb, line 211
def auth_tag
  auth_tag_b64 = @encrypted_data["auth_tag"]
  if auth_tag_b64.nil?
    raise DecryptionFailure, "Error decrypting data bag value: invalid authentication tag. Most likely the data is corrupted"
  end
  Base64.decode64(auth_tag_b64)
end
openssl_decryptor() click to toggle source
# File lib/chef/encrypted_data_bag_item/decryptor.rb, line 219
def openssl_decryptor
  @openssl_decryptor ||=
    begin
      d = super
      d.auth_tag = auth_tag
      d.auth_data = ""
      d
    end
end