Class: Xmlenc::Algorithms::AESCBC
- Inherits:
-
Object
- Object
- Xmlenc::Algorithms::AESCBC
- Defined in:
- lib/xmlenc/algorithms/aes_cbc.rb
Class Method Summary collapse
Instance Method Summary collapse
- #decrypt(cipher_value, options = {}) ⇒ Object
-
#initialize(size) ⇒ AESCBC
constructor
A new instance of AESCBC.
- #setup(key) ⇒ Object
Constructor Details
#initialize(size) ⇒ AESCBC
Returns a new instance of AESCBC.
10 11 12 |
# File 'lib/xmlenc/algorithms/aes_cbc.rb', line 10 def initialize(size) @size = size end |
Class Method Details
.[](size) ⇒ Object
5 6 7 |
# File 'lib/xmlenc/algorithms/aes_cbc.rb', line 5 def [](size) new(size) end |
Instance Method Details
#decrypt(cipher_value, options = {}) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/xmlenc/algorithms/aes_cbc.rb', line 19 def decrypt(cipher_value, = {}) cipher.decrypt cipher.key = @key cipher.iv = cipher_value[0...iv_len] result = cipher.update(cipher_value[iv_len..-1]) result << cipher.final end |
#setup(key) ⇒ Object
14 15 16 17 |
# File 'lib/xmlenc/algorithms/aes_cbc.rb', line 14 def setup(key) @key = key self end |