secure_yaml 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/secure_yaml/cipher.rb +6 -2
- data/lib/secure_yaml/version.rb +1 -1
- metadata +1 -1
data/lib/secure_yaml/cipher.rb
CHANGED
@@ -9,13 +9,13 @@ module SecureYaml
|
|
9
9
|
def encrypt(secret_key, plain_data)
|
10
10
|
cipher = create_cipher(secret_key)
|
11
11
|
cipher.encrypt
|
12
|
-
Base64.
|
12
|
+
strip_newline_chars_from_base64(Base64.encode64(cipher.update(plain_data) + cipher.final))
|
13
13
|
end
|
14
14
|
|
15
15
|
def decrypt(secret_key, encrypted_data)
|
16
16
|
cipher = create_cipher(secret_key)
|
17
17
|
cipher.decrypt
|
18
|
-
cipher.update(Base64.
|
18
|
+
cipher.update(Base64.decode64(encrypted_data)) + cipher.final
|
19
19
|
end
|
20
20
|
|
21
21
|
private
|
@@ -27,6 +27,10 @@ module SecureYaml
|
|
27
27
|
cipher
|
28
28
|
end
|
29
29
|
|
30
|
+
def strip_newline_chars_from_base64(base64)
|
31
|
+
base64.gsub("\n", '')
|
32
|
+
end
|
33
|
+
|
30
34
|
end
|
31
35
|
|
32
36
|
end
|
data/lib/secure_yaml/version.rb
CHANGED