Class: Trocla::Encryptions::Ssl
- Inherits:
-
Base
- Object
- Base
- Trocla::Encryptions::Ssl
show all
- Defined in:
- lib/trocla/encryptions/ssl.rb
Instance Attribute Summary
Attributes inherited from Base
#config, #trocla
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Instance Method Details
#decrypt(value) ⇒ Object
13
14
15
16
17
18
19
|
# File 'lib/trocla/encryptions/ssl.rb', line 13
def decrypt(value)
plaintext = ''
value.split(/\n/).each do |line|
plaintext += private_key.private_decrypt(Base64.decode64(line)) if line
end
plaintext
end
|
#encrypt(value) ⇒ Object
5
6
7
8
9
10
11
|
# File 'lib/trocla/encryptions/ssl.rb', line 5
def encrypt(value)
ciphertext = ''
value.scan(/.{0,#{chunksize}}/m).each do |chunk|
ciphertext += Base64.encode64(public_key.public_encrypt(chunk)).gsub("\n", '') + "\n" if chunk
end
ciphertext
end
|