Class: SecureYaml::Cipher

Inherits:
Object
  • Object
show all
Defined in:
lib/config/patch/secure_yaml/cipher.rb

Instance Method Summary collapse

Instance Method Details

#decrypt(secret_key, encrypted_data) ⇒ Object



14
15
16
17
# File 'lib/config/patch/secure_yaml/cipher.rb', line 14

def decrypt(secret_key, encrypted_data)
  cipher = create_cipher(secret_key, :decrypt)
  cipher.update(Base64.decode64(encrypted_data)) + cipher.final
end

#encrypt(secret_key, plain_data) ⇒ Object



9
10
11
12
# File 'lib/config/patch/secure_yaml/cipher.rb', line 9

def encrypt(secret_key, plain_data)
  cipher = create_cipher(secret_key, :encrypt)
  strip_newline_chars_from_base64(Base64.encode64(cipher.update(plain_data) + cipher.final))
end