Sha256: c8391a47a1ffc5a2ba55364e826767a8943f6e65abea007c339569cd40170c05
Contents?: true
Size: 781 Bytes
Versions: 3
Compression:
Stored size: 781 Bytes
Contents
module Xmlenc module Algorithms class DES3CBC def self.setup(key) new(key) end def initialize(key = nil) @key = key || cipher.random_key end def decrypt(cipher_value, options = {}) cipher.decrypt cipher.key = @key cipher.iv = cipher_value[0...iv_len] cipher.update(cipher_value[iv_len..-1]) << cipher.final end def encrypt(data, options = {}) cipher.encrypt cipher.key = @key cipher.iv = iv iv << cipher.update(data) << cipher.final end def key @key end private def iv_len cipher.iv_len end def cipher @cipher ||= OpenSSL::Cipher.new('des-ede3-cbc') end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
xmlenc-0.8.0 | lib/xmlenc/algorithms/des3_cbc.rb |
xmlenc-0.7.1 | lib/xmlenc/algorithms/des3_cbc.rb |
xmlenc-0.7.0 | lib/xmlenc/algorithms/des3_cbc.rb |