lib/symmetric_encryption/keystore/gcp.rb in symmetric-encryption-4.3.2 vs lib/symmetric_encryption/keystore/gcp.rb in symmetric-encryption-4.3.3
- old
+ new
@@ -3,11 +3,11 @@
module SymmetricEncryption
module Keystore
class Gcp
include Utils::Files
- def self.generate_data_key(version: 0, cipher_name:, app_name:, environment:, key_path:)
+ def self.generate_data_key(cipher_name:, app_name:, environment:, key_path:, version: 0)
version >= 255 ? (version = 1) : (version += 1)
dek = SymmetricEncryption::Key.new(cipher_name: cipher_name)
file_name = "#{key_path}/#{app_name}_#{environment}_v#{version}.encrypted_key"
keystore = new(
@@ -44,10 +44,11 @@
def write(data_key)
write_encoded_to_file(file_name, encrypt(data_key))
end
def crypto_key
- @crypto_key ||= self.class::KMS::KeyManagementServiceClient.crypto_key_path(project_id, location_id, app_name, environment.to_s)
+ @crypto_key ||= self.class::KMS::KeyManagementServiceClient.crypto_key_path(project_id, location_id, app_name,
+ environment.to_s)
end
private
KMS = Google::Cloud::Kms::V1