Skip to content

Commit

Permalink
JRuby fixes for OpenOffice
Browse files Browse the repository at this point in the history
Updated travis JRuby
  • Loading branch information
stevendaniels committed Dec 30, 2016
1 parent 3690462 commit 0a8a63c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
6 changes: 4 additions & 2 deletions .travis.yml
Expand Up @@ -4,16 +4,18 @@ rvm:
- 2.3.1
- 2.4.0
- ruby-head
- jruby-19mode # JRuby in 1.9 mode
- rbx-2
- jruby-9.1.6.0
matrix:
include:
- rvm: 2.0.0
gemfile: Gemfile_ruby2
- rvm: 2.1.8
gemfile: Gemfile_ruby2
- rvm: jruby-19mode
gemfile: Gemfile_ruby2
allow_failures:
- rvm: ruby-head
- rvm: jruby-19mode
- rvm: jruby-9.1.6.0
- rvm: rbx-2
bundler_args: --without local_development
5 changes: 3 additions & 2 deletions lib/roo/open_office.rb
Expand Up @@ -5,6 +5,7 @@
require 'roo/font'
require 'roo/tempdir'
require 'base64'
require 'openssl'

module Roo
class OpenOffice < Roo::Base
Expand Down Expand Up @@ -345,7 +346,7 @@ def perform_decryption(
def find_cipher(*args)
fail ArgumentError, 'Unknown algorithm ' + algorithm unless args[0] == 'http://www.w3.org/2001/04/xmlenc#aes256-cbc'

cipher = OpenSSL::Cipher.new('AES-256-CBC')
cipher = ::OpenSSL::Cipher.new('AES-256-CBC')
cipher.decrypt
cipher.padding = 0
cipher.key = find_cipher_key(cipher, *args[1..4])
Expand All @@ -358,7 +359,7 @@ def find_cipher(*args)
def find_cipher_key(*args)
fail ArgumentError, 'Unknown key derivation name ', args[1] unless args[1] == 'PBKDF2'

OpenSSL::PKCS5.pbkdf2_hmac_sha1(args[2], args[3], args[4], args[0].key_len)
::OpenSSL::PKCS5.pbkdf2_hmac_sha1(args[2], args[3], args[4], args[0].key_len)
end

# Block decrypt raw bytes from the zip file based on the cipher
Expand Down
3 changes: 3 additions & 0 deletions test/test_roo.rb
@@ -1,3 +1,4 @@
# encoding: utf-8

# Dump warnings that come from the test to open files
# with the wrong spreadsheet class
Expand Down Expand Up @@ -1494,6 +1495,8 @@ def test_close
# process and passed the temp directories from the forked process in
# order to check if they were removed properly.
def test_finalize
skip if defined? JRUBY_VERSION

read, write = IO.pipe
pid = Process.fork do
with_each_spreadsheet(name: "numbers1") do |oo|
Expand Down

0 comments on commit 0a8a63c

Please sign in to comment.