Class: Ccs::Encrypter
- Inherits:
-
Object
- Object
- Ccs::Encrypter
- Defined in:
- lib/ccs/encrypter.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(passphrase, content, salt) ⇒ Encrypter
constructor
A new instance of Encrypter.
Constructor Details
#initialize(passphrase, content, salt) ⇒ Encrypter
Returns a new instance of Encrypter.
5 6 7 8 9 |
# File 'lib/ccs/encrypter.rb', line 5 def initialize(passphrase, content, salt) @passphrase = passphrase @content = content @salt = salt end |
Instance Method Details
#call ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/ccs/encrypter.rb', line 11 def call encryptor.pkcs5_keyivgen(@passphrase, @salt, 1) encrypted = encryptor.update(@content) encrypted << encryptor.final openssl_salted_ciphertext = 'Salted__' + @salt + encrypted Base64.strict_encode64(openssl_salted_ciphertext) end |