Sha256: e2b1f33e827ec177d6c10821661b9f6187010946719ae7962cfbd2ed9857103d
Contents?: true
Size: 789 Bytes
Versions: 23
Compression:
Stored size: 789 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::Cipher.new('des-ede3-cbc') end end end end
Version data entries
23 entries across 23 versions & 1 rubygems