Skip to content
Permalink
Browse files
Merge branch 'test-jossl-0.9.6'
Conflicts:
	lib/pom.rb
	maven/jruby-complete/src/it/integrity/verify.bsh
	maven/jruby-dist/src/it/integrity/verify.bsh
	maven/jruby-jars/src/it/integrity/verify.bsh
	maven/jruby/src/it/integrity/verify.bsh
	test/externals/ruby1.9/excludes/OpenSSL/TestASN1.rb
	test/externals/ruby1.9/excludes/OpenSSL/TestDigest.rb
	test/externals/ruby1.9/openssl/test_asn1.rb
	test/externals/ruby1.9/openssl/test_certificate.rb
	test/test_command_line_switches.rb
  • Loading branch information
mkristian committed Dec 18, 2014
2 parents ffa0ce2 + 0235fc5 commit 08ae0770e701f8e61afffcfc15c7f5a6b21f6261
@@ -32,6 +32,7 @@ build jruby-complete.jar
<arg value='-rminitest/excludes'/>
<arg value='lib/ruby/gems/shared/gems/rake-10.1.0/lib/rake/rake_test_loader.rb'/>
<arg value='test/test_globals.rb'/>
<arg value='test/test_adding_pem_to_x509store.rb'/>
<arg value='test/test_argf.rb'/>
<arg value='test/test_array.rb'/>
<arg value='test/test_autoload.rb'/>
@@ -17,21 +17,15 @@ def version
end
end

KRYPT_VERSION = '0.0.2'

# the versions are declared in ../pom.xml
default_gems =
[
ImportedGem.new( 'jruby-openssl', '0.9.5', true ),
ImportedGem.new( 'jruby-openssl', '0.9.6.dev-SNAPSHOT', true ),
ImportedGem.new( 'jruby-readline', '1.0.dev-SNAPSHOT', false ),
ImportedGem.new( 'jruby-ripper', '2.1.0.dev-SNAPSHOT', false ),
ImportedGem.new( 'rake', 'rake.version', true ),
ImportedGem.new( 'rdoc', 'rdoc.version', true ),
ImportedGem.new( 'json', 'json.version', true ),
ImportedGem.new( 'krypt', KRYPT_VERSION, true ),
ImportedGem.new( 'krypt-core', KRYPT_VERSION, true ),
ImportedGem.new( 'krypt-provider-jdk', KRYPT_VERSION, true ),
ImportedGem.new( 'ffi', '1.9.3', true ),
ImportedGem.new( 'jar-dependencies', '0.1.2', true ),
ImportedGem.new( 'minitest', 'minitest.version', true ),
ImportedGem.new( 'test-unit', 'test-unit.version', true ),
@@ -222,22 +216,6 @@ def to_pathname
f = File.join( ruby_dir, 'stdlib', 'jruby-openssl.rb' )
File.delete( f ) if File.exists?( f )

# PATCH krypt
if KRYPT_VERSION == '0.0.2'
file = ctx.basedir.to_pathname + '/ruby/stdlib/krypt/provider.rb'
content = File.read( file )
content.sub! /begin(.|[\n])*/, <<EOS
unless java?
require_relative 'provider/ffi'
end
EOS
File.open( file, 'w' ) do |f|
f.print content
end
else
raise "please remove the obsolete PATCH for krypt in lib/pom.rb"
end

# we do not want rubygems_plugin.rb within jruby
f = File.join( ruby_dir, 'stdlib', 'rubygems_plugin.rb' )
File.delete( f ) if File.exists?( f )
@@ -246,5 +224,5 @@ def to_pathname
( Dir[ File.join( jruby_gems, '**/*' ) ] + Dir[ File.join( jruby_gems, '**/.*' ) ] ).each do |f|
File.chmod( 0644, f ) rescue nil if File.file?( f )
end
end
end
end
@@ -25,7 +25,7 @@
<dependency>
<groupId>rubygems</groupId>
<artifactId>jruby-openssl</artifactId>
<version>0.9.5</version>
<version>0.9.6.dev-SNAPSHOT</version>
<type>gem</type>
</dependency>
<dependency>
@@ -58,30 +58,6 @@
<version>${json.version}</version>
<type>gem</type>
</dependency>
<dependency>
<groupId>rubygems</groupId>
<artifactId>krypt</artifactId>
<version>0.0.2</version>
<type>gem</type>
</dependency>
<dependency>
<groupId>rubygems</groupId>
<artifactId>krypt-core</artifactId>
<version>0.0.2</version>
<type>gem</type>
</dependency>
<dependency>
<groupId>rubygems</groupId>
<artifactId>krypt-provider-jdk</artifactId>
<version>0.0.2</version>
<type>gem</type>
</dependency>
<dependency>
<groupId>rubygems</groupId>
<artifactId>ffi</artifactId>
<version>1.9.3</version>
<type>gem</type>
</dependency>
<dependency>
<groupId>rubygems</groupId>
<artifactId>jar-dependencies</artifactId>
@@ -125,7 +125,6 @@
<argument>
require 'jar-dependencies'
require 'openssl'
require 'krypt'
puts Gem.loaded_specs.keys.sort.join(',')
</argument>
</arguments>
@@ -28,12 +28,12 @@ if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
}
expected = "gems count 12";
expected = "gems count 8";
if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
}
expected = "ffi,jar-dependencies,jruby-openssl,krypt,krypt-core,krypt-provider-jdk";
expected = "jar-dependencies,jruby-openssl";
if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
@@ -110,15 +110,15 @@ public void testJRubyCreate() throws Exception {
loaded = (Boolean) jruby.runScriptlet( "require 'openssl'" );
assertEquals(true, loaded);

jruby.runScriptlet( "require 'jar-dependencies'; require 'krypt'" );
jruby.runScriptlet( "require 'jar-dependencies'" );
list = (String) jruby.runScriptlet( "Gem.loaded_specs.keys.inspect" );
assertEquals(list, "[\"rake\", \"jruby-openssl\", \"jar-dependencies\", \"ffi\", \"krypt-provider-jdk\", \"krypt-core\", \"krypt\"]");
assertEquals(list, "[\"rake\", \"jruby-openssl\", \"jar-dependencies\"]");

// ensure we can load can load embedded gems
loaded = (Boolean) jruby.runScriptlet( "require 'virtus'" );
assertEquals(true, loaded);

list = (String) jruby.runScriptlet( "Gem.loaded_specs.keys.inspect" );
assertEquals(list, "[\"rake\", \"jruby-openssl\", \"jar-dependencies\", \"ffi\", \"krypt-provider-jdk\", \"krypt-core\", \"krypt\", \"thread_safe\", \"descendants_tracker\", \"equalizer\", \"coercible\", \"ice_nine\", \"axiom-types\", \"virtus\"]");
assertEquals(list, "[\"rake\", \"jruby-openssl\", \"jar-dependencies\", \"thread_safe\", \"descendants_tracker\", \"equalizer\", \"coercible\", \"ice_nine\", \"axiom-types\", \"virtus\"]");
}
}
@@ -142,7 +142,6 @@
<argument>
require 'jar-dependencies'
require 'openssl'
require 'krypt'
puts Gem.loaded_specs.keys.sort.join(',')
</argument>
</arguments>
@@ -28,12 +28,12 @@ if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
}
expected = "gems count 12";
expected = "gems count 8";
if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
}
expected = "ffi,jar-dependencies,jruby-openssl,krypt,krypt-core,krypt-provider-jdk";
expected = "jar-dependencies,jruby-openssl";
if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
@@ -14,7 +14,7 @@

public class SimpleTest {

private final String basedir = new File( "../../../../../" ).getAbsolutePath();
private final String basedir = new File( System.getProperty("basedir"), "../../../../../" ).getAbsolutePath();

private ScriptingContainer newScriptingContainer() {
ScriptingContainer container = new ScriptingContainer(LocalContextScope.SINGLETHREAD);
@@ -131,7 +131,6 @@
<argument>
require 'jar-dependencies'
require 'openssl'
require 'krypt'
puts Gem.loaded_specs.keys.sort.join(',')
</argument>
</arguments>
@@ -28,12 +28,12 @@ if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
}
expected = "gems count 12";
expected = "gems count 8";
if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
}
expected = "ffi,jar-dependencies,jruby-openssl,krypt,krypt-core,krypt-provider-jdk";
expected = "jar-dependencies,jruby-openssl";
if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
@@ -14,7 +14,7 @@

public class SimpleTest {

private final String basedir = new File( "../../../../../" ).getAbsolutePath();
private final String basedir = new File( System.getProperty("basedir"), "../../../../../" ).getAbsolutePath();

private ScriptingContainer newScriptingContainer() {
ScriptingContainer container = new ScriptingContainer(LocalContextScope.SINGLETHREAD);
@@ -125,7 +125,6 @@
<argument>
require 'jar-dependencies'
require 'openssl'
require 'krypt'
puts Gem.loaded_specs.keys.sort.join(',')
</argument>
</arguments>
@@ -28,12 +28,12 @@ if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
}
expected = "gems count 12";
expected = "gems count 8";
if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
}
expected = "ffi,jar-dependencies,jruby-openssl,krypt,krypt-core,krypt-provider-jdk";
expected = "jar-dependencies,jruby-openssl";
if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
@@ -95,15 +95,15 @@ public void testJRubyCreate() throws InterruptedException {
gemPath = gemPath.replaceAll( "bundle[^:]*://[^/]*", "bundle:/" );
assertEquals( gemPath, "[\"uri:classloader:/specifications\", \"uri:classloader:/META-INF/jruby.home/lib/ruby/gems/shared/specifications\"]" );

jruby.runScriptlet( "require 'jar-dependencies'; require 'krypt'" );
jruby.runScriptlet( "require 'jar-dependencies'" );
list = (String) jruby.runScriptlet( "Gem.loaded_specs.keys.inspect" );
assertEquals(list, "[\"rake\", \"jruby-openssl\", \"jar-dependencies\", \"ffi\", \"krypt-provider-jdk\", \"krypt-core\", \"krypt\"]");
assertEquals(list, "[\"rake\", \"jruby-openssl\", \"jar-dependencies\"]");

// ensure we can load can load embedded gems
loaded = (Boolean) jruby.runScriptlet( "require 'virtus'" );
assertEquals(true, loaded);

list = (String) jruby.runScriptlet( "Gem.loaded_specs.keys.inspect" );
assertEquals(list, "[\"rake\", \"jruby-openssl\", \"jar-dependencies\", \"ffi\", \"krypt-provider-jdk\", \"krypt-core\", \"krypt\", \"thread_safe\", \"descendants_tracker\", \"equalizer\", \"coercible\", \"ice_nine\", \"axiom-types\", \"virtus\"]");
assertEquals(list, "[\"rake\", \"jruby-openssl\", \"jar-dependencies\", \"thread_safe\", \"descendants_tracker\", \"equalizer\", \"coercible\", \"ice_nine\", \"axiom-types\", \"virtus\"]");
}
}
@@ -1,3 +1,4 @@

require File.dirname(__FILE__) + "/../spec_helper"

require 'rubygems'
@@ -16,7 +17,7 @@
url_paths = ["file:/var/tmp",
"http://jruby.org",
"classpath:/META-INF/jruby.home",
"uri:bundle://13.0:1/META-INF/jruby.home",
"uri:jar:file://META-INF/jruby.home!/some/path",
"jar:file:/var/tmp/some.jar!/some/path"]
Gem.use_paths(nil, url_paths)
Gem.path.should include(*url_paths)
@@ -29,8 +30,8 @@
File.exist?("classpath:/bogus/classpath").should be_false
Gem.ensure_gem_subdirectories("file:")
File.exist?("file:").should be_false
Gem.ensure_gem_subdirectories("uri:bundle://13.0:1/bogus/classpath")
File.exist?("uri:bundle://13.0:1").should be_false
File.exist?("uri:bundle://13.0:1/bogus/classpath").should be_false
Gem.ensure_gem_subdirectories("uri:file://bogus/classpath")
File.exist?("uri:file:///nothing").should be_false
File.exist?("uri:file://bogus/classpath").should be_false
end
end

This file was deleted.

@@ -0,0 +1 @@
exclude :test_extension, 'Can not guarantee extension order using Java APIs'
@@ -0,0 +1,21 @@
require 'test/unit'
require 'openssl'

class TestOpenssl < Test::Unit::TestCase
def test_adding_pem
OpenSSL.debug = true
# mimic what rubygems/request#add_rubygems_trusted_certs does
# to find the pem certificates
base = $LOAD_PATH.detect { |p| p =~ /ruby\/stdlib/ }
pems = Dir[ File.join(base, 'rubygems/ssl_certs/*pem') ]
assert_equal( 9, pems.size )
pems.each do |pem|
store = OpenSSL::X509::Store.new
cert = OpenSSL::X509::Certificate.new(File.read(pem))
assert( !store.verify(cert) )
store.add_file(pem)
# only verify on self signed certifactes
assert( store.verify(cert) ) unless pem =~ /AddTrustExternalCARoot.pem/
end
end
end
@@ -1,23 +1,16 @@
exclude :test_bit_string_infinite_length, 'needs investigation'
exclude :test_bit_string_infinite_length, 'encoding works but decoding not implemented'
exclude :test_cons_explicit_tagging, 'needs investigation'
exclude :test_cons_explicit_tagging_inf_length, 'needs investigation'
exclude :test_cons_implicit_tagging, 'needs investigation'
exclude :test_cons_implicit_tagging_inf_length, 'needs investigation'
exclude :test_cons_without_array_forbidden, 'needs investigation'
exclude :test_cons_without_inf_length_forbidden, 'needs investigation'
exclude :test_create_inf_length_primitive, 'needs investigation'
exclude :test_decode_all, 'needs investigation'
exclude :test_decode_pem, 'needs investigation'
exclude :test_encode_nil, 'needs investigation'
exclude :test_octet_string_infinite_length, 'needs investigation'
exclude :test_octet_string_infinite_length_explicit_tagging, 'needs investigation'
exclude :test_octet_string_infinite_length_implicit_tagging, 'needs investigation'
exclude :test_parse_empty_sequence, 'needs investigation'
exclude :test_parse_tagged_0_infinite, 'needs investigation'
exclude :test_prim_explicit_tagging, 'needs investigation'
exclude :test_prim_implicit_tagging, 'needs investigation'
exclude :test_primitive_inf_length, 'needs investigation'
exclude :test_recursive_octet_string_infinite_length, 'needs investigation'
exclude :test_recursive_octet_string_parse, 'needs investigation'
exclude :test_seq_infinite_length, 'needs investigation'
exclude :test_set_infinite_length, 'needs investigation'
@@ -1,2 +1,2 @@
exclude :test_AES, 'needs investigation'
exclude :test_AES, 'works - just need to enable JCE unlimited strength'
exclude :test_AES_crush, 'needs investigation'
@@ -1,2 +0,0 @@
exclude :test_digest_by_oid_and_name_sha2, 'Java exception raised'
exclude :test_openssl_digest, 'Java exception raised'
@@ -1,2 +0,0 @@
exclude :test_spaceship, 'needs investigation'
exclude :test_unrecognized_oid, 'needs investigation'
@@ -1,3 +1,3 @@
exclude :test_attr, 'Java exception raised'
exclude :test_attr, 'fails with <2> expected but was <0> [test_x509req.rb:94]'
exclude :test_sign_and_verify, 'Version broke in recent rewrite'
exclude :test_version, 'Version broke in recent rewrite'
@@ -186,8 +186,12 @@ def test_decode
assert_equal(OpenSSL::ASN1::Null, pkey.value[0].value[1].class)

assert_equal(OpenSSL::ASN1::BitString, sig_val.class)
cululated_sig = key.sign(OpenSSL::Digest::SHA1.new, tbs_cert.to_der)
assert_equal(cululated_sig, sig_val.value)

# since the direct compare of signatures does not work
# we verify the signature via the certificate itself
assert OpenSSL::X509::Certificate.new( cert.to_der ).verify key
#cululated_sig = key.sign(OpenSSL::Digest::SHA1.new, tbs_cert.to_der)
#assert_equal(cululated_sig, sig_val.value)
end

def test_encode_boolean

0 comments on commit 08ae077

Please sign in to comment.