Class: SecureYaml::Cipher

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

Instance Method Summary collapse

Instance Method Details

#decrypt(secret_key, encrypted_data) ⇒ Object



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

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

#encrypt(secret_key, plain_data) ⇒ Object



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

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