Class: Ccs::Decrypter
- Inherits:
-
Object
- Object
- Ccs::Decrypter
- Defined in:
- lib/ccs/decrypter.rb
Overview
Handles client-side decryption for documents.
The decrypter uses AES-256 in CBC mode internally. A salt is expected in bytes 8..15, with ciphertext occupying the further bytes.
Instance Method Summary collapse
-
#call ⇒ String
Performs decryption, returning plaintext if passphrase matched.
-
#initialize(passphrase, content) ⇒ Decrypter
constructor
Constructs a Decrypter instance with given passphrase and content.
Constructor Details
#initialize(passphrase, content) ⇒ Decrypter
Constructs a Decrypter instance with given passphrase and content.
17 18 19 20 |
# File 'lib/ccs/decrypter.rb', line 17 def initialize(passphrase, content) @passphrase = passphrase @content = content end |
Instance Method Details
#call ⇒ String
Performs decryption, returning plaintext if passphrase matched.
25 26 27 28 29 |
# File 'lib/ccs/decrypter.rb', line 25 def call decryptor.pkcs5_keyivgen(@passphrase, ciphertext_salt, 1) result = decryptor.update(encrypted) result << decryptor.final end |