Sha256: 994a7840f0f592a2ae92aacc50c92d0b9f59bf5bc6d1c5257a28e8b7ef4a3641
Contents?: true
Size: 716 Bytes
Versions: 1
Compression:
Stored size: 716 Bytes
Contents
require 'openssl' module Heirloom module Cipher class Data def initialize(args) @config = args[:config] @logger = @config.logger end def decrypt_data(args) data = args[:data] secret = args[:secret] return data unless secret @logger.info "Secret provided. Decrypting archive." @aes = OpenSSL::Cipher::AES256.new(:CBC) @aes.decrypt @aes.key = secret @aes.iv = data.slice!(0,16) begin @aes.update(data) + @aes.final rescue OpenSSL::Cipher::CipherError => e @logger.error "Unable to decrypt archive: '#{e.message}'" false end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
heirloom-0.5.0rc3 | lib/heirloom/cipher/data.rb |