Sha256: 4a949b027c58812fc3c04f9f4f063a1d0fbbf96c98eaee6f53ae819ff43eac7b

Contents?: true

Size: 575 Bytes

Versions: 3

Compression:

Stored size: 575 Bytes

Contents

class SlackSmartBot
  module Utils
    module Encryption
      def self.decrypt(data, config)
        if config.encrypt
          require "openssl"
          require "base64"

          key, iv = Utils::Encryption.encryption_get_key_iv(config)
          encrypted = Base64.decode64(data)
          cipher = OpenSSL::Cipher.new("AES-256-CBC")
          cipher.decrypt
          cipher.key = key
          cipher.iv = iv
          plain = cipher.update(encrypted) + cipher.final
          return plain
        else
          return data
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
slack-smart-bot-1.14.2 lib/slack/smart-bot/utils/encryption/decrypt.rb
slack-smart-bot-1.14.1 lib/slack/smart-bot/utils/encryption/decrypt.rb
slack-smart-bot-1.14.0 lib/slack/smart-bot/utils/encryption/decrypt.rb