class Google::Cloud::Storage::Service

def encryption_key_headers options, key, copy_source: false

Parameters:
  • copy_source () -- If true, header names are those for source object

Other tags:
    Private: -
def encryption_key_headers options, key, copy_source: false
  source = copy_source ? "copy-source-" : ""
  key_sha256 = Digest::SHA256.digest key
  headers = (options[:header] ||= {})
  headers["x-goog-#{source}encryption-algorithm"] = "AES256"
  headers["x-goog-#{source}encryption-key"] = Base64.strict_encode64 key
  headers["x-goog-#{source}encryption-key-sha256"] = Base64.strict_encode64 key_sha256
  options
end