Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 40ba65578a6d
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 5fb1882f23a3
Choose a head ref
  • 15 commits
  • 24 files changed
  • 2 contributors

Commits on Dec 19, 2014

  1. Copy the full SHA
    4022827 View commit details
  2. Copy the full SHA
    045c3f7 View commit details
  3. we can not guarantee extension ordering using Java APIs (otherwise th…

    …is rolls fine)
    
    ... and there's the same test without the extension order passing at :
    jruby/jruby-openssl@eb30f9bd73ae25750593
    kares authored and mkristian committed Dec 19, 2014
    Copy the full SHA
    abdbb33 View commit details
  4. Copy the full SHA
    e0cd2cb View commit details
  5. Copy the full SHA
    d7ed2f1 View commit details
  6. Copy the full SHA
    b967da6 View commit details
  7. Copy the full SHA
    5f831d2 View commit details
  8. Copy the full SHA
    463f8ad View commit details
  9. follow the fix of jruby/jruby-openssl#18

    Sponsored by Lookout Inc.
    mkristian committed Dec 19, 2014
    Copy the full SHA
    d7c39c6 View commit details
  10. Copy the full SHA
    5160be1 View commit details
  11. Copy the full SHA
    7e83990 View commit details
  12. Copy the full SHA
    d50d7ac View commit details
  13. Revert "[build] removed obsolete monkey patches"

    This reverts commit 30dad24.
    mkristian committed Dec 19, 2014
    Copy the full SHA
    0a3ba73 View commit details
  14. Copy the full SHA
    58a493a View commit details
  15. use jruby-openssl-0.9.6

    mkristian committed Dec 19, 2014
    Copy the full SHA
    5fb1882 View commit details
1 change: 1 addition & 0 deletions antlib/extra.xml
Original file line number Diff line number Diff line change
@@ -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'/>
26 changes: 2 additions & 24 deletions lib/pom.rb
Original file line number Diff line number Diff line change
@@ -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', 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
26 changes: 1 addition & 25 deletions lib/pom.xml
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@
<dependency>
<groupId>rubygems</groupId>
<artifactId>jruby-openssl</artifactId>
<version>0.9.5</version>
<version>0.9.6</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>
1 change: 0 additions & 1 deletion maven/jruby-complete/src/it/integrity/pom.xml
Original file line number Diff line number Diff line change
@@ -125,7 +125,6 @@
<argument>
require 'jar-dependencies'
require 'openssl'
require 'krypt'
puts Gem.loaded_specs.keys.sort.join(',')
</argument>
</arguments>
4 changes: 2 additions & 2 deletions maven/jruby-complete/src/it/integrity/verify.bsh
Original file line number Diff line number Diff line change
@@ -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 + "'" );
Original file line number Diff line number Diff line change
@@ -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\"]");
}
}
1 change: 0 additions & 1 deletion maven/jruby-dist/src/it/integrity/pom.xml
Original file line number Diff line number Diff line change
@@ -142,7 +142,6 @@
<argument>
require 'jar-dependencies'
require 'openssl'
require 'krypt'
puts Gem.loaded_specs.keys.sort.join(',')
</argument>
</arguments>
4 changes: 2 additions & 2 deletions maven/jruby-dist/src/it/integrity/verify.bsh
Original file line number Diff line number Diff line change
@@ -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 + "'" );
1 change: 0 additions & 1 deletion maven/jruby-jars/src/it/integrity/pom.xml
Original file line number Diff line number Diff line change
@@ -131,7 +131,6 @@
<argument>
require 'jar-dependencies'
require 'openssl'
require 'krypt'
puts Gem.loaded_specs.keys.sort.join(',')
</argument>
</arguments>
4 changes: 2 additions & 2 deletions maven/jruby-jars/src/it/integrity/verify.bsh
Original file line number Diff line number Diff line change
@@ -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 + "'" );
1 change: 0 additions & 1 deletion maven/jruby/src/it/integrity/pom.xml
Original file line number Diff line number Diff line change
@@ -125,7 +125,6 @@
<argument>
require 'jar-dependencies'
require 'openssl'
require 'krypt'
puts Gem.loaded_specs.keys.sort.join(',')
</argument>
</arguments>
4 changes: 2 additions & 2 deletions maven/jruby/src/it/integrity/verify.bsh
Original file line number Diff line number Diff line change
@@ -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 + "'" );
Original file line number Diff line number Diff line change
@@ -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\"]");
}
}
4 changes: 2 additions & 2 deletions spec/java_integration/rubygems/rubygems_spec.rb
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@
url_paths = ["file:/var/tmp",
"http://jruby.org",
"classpath:/META-INF/jruby.home",
"uri:jar:file://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)
@@ -32,6 +32,6 @@
File.exist?("file:").should be_false
Gem.ensure_gem_subdirectories("uri:file://bogus/classpath")
File.exist?("uri:file:///nothing").should be_false
File.exist?("uri:jar://bogus/classpath").should be_false
File.exist?("uri:file://bogus/classpath").should be_false
end
end
20 changes: 0 additions & 20 deletions spec/regression/GH-1800_krypt_ffi_regression_spec.rb

This file was deleted.

1 change: 1 addition & 0 deletions test/externals/ruby1.9/excludes/OpenSSL/TestX509CRL.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
exclude :test_extension, 'Can not guarantee extension order using Java APIs'
150 changes: 150 additions & 0 deletions test/externals/ruby1.9/openssl/test_certificate.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
require 'openssl'
require "test/unit"

class TestCertificate < Test::Unit::TestCase
def setup
cert_file = File.expand_path('fixture/selfcert.pem', File.dirname(__FILE__))
key_file = File.expand_path('fixture/keypair.pem', File.dirname(__FILE__))
@cert = OpenSSL::X509::Certificate.new(File.read(cert_file))
@key = OpenSSL::PKey::RSA.new(File.read(key_file))
end

def test_sign_for_pem_initialized_certificate
pem = @cert.to_pem
exts = @cert.extensions
assert_nothing_raised do
@cert.sign(@key, OpenSSL::Digest::SHA1.new)
end
# TODO: for now, jruby-openssl cannot keep order of extensions after sign.
# assert_equal(pem, @cert.to_pem)
assert_equal(exts.size, @cert.extensions.size)
exts.each do |ext|
found = @cert.extensions.find { |e| e.oid == ext.oid }
assert_not_nil(found)
assert_equal(ext.value, found.value)
end
end

def test_set_public_key
newkey = OpenSSL::PKey::RSA.new(1024)
@cert.public_key = newkey
assert_equal(newkey.public_key.to_pem, @cert.public_key.to_pem)
end

# JRUBY-3468
def test_cert_extensions
pem_cert = <<END
-----BEGIN CERTIFICATE-----
MIIC/jCCAmegAwIBAgIBATANBgkqhkiG9w0BAQUFADBNMQswCQYDVQQGEwJKUDER
MA8GA1UECgwIY3Rvci5vcmcxFDASBgNVBAsMC0RldmVsb3BtZW50MRUwEwYDVQQD
DAxodHRwLWFjY2VzczIwHhcNMDcwOTExMTM1ODMxWhcNMDkwOTEwMTM1ODMxWjBN
MQswCQYDVQQGEwJKUDERMA8GA1UECgwIY3Rvci5vcmcxFDASBgNVBAsMC0RldmVs
b3BtZW50MRUwEwYDVQQDDAxodHRwLWFjY2VzczIwgZ8wDQYJKoZIhvcNAQEBBQAD
gY0AMIGJAoGBALi66ujWtUCQm5HpMSyr/AAIFYVXC/dmn7C8TR/HMiUuW3waY4uX
LFqCDAGOX4gf177pX+b99t3mpaiAjJuqc858D9xEECzhDWgXdLbhRqWhUOble4RY
c1yWYC990IgXJDMKx7VAuZ3cBhdBxtlE9sb1ZCzmHQsvTy/OoRzcJCrTAgMBAAGj
ge0wgeowDwYDVR0TAQH/BAUwAwEB/zAxBglghkgBhvhCAQ0EJBYiUnVieS9PcGVu
U1NMIEdlbmVyYXRlZCBDZXJ0aWZpY2F0ZTAdBgNVHQ4EFgQUJNE0GGaRKmN2qhnO
FyBWVl4Qj6owDgYDVR0PAQH/BAQDAgEGMHUGA1UdIwRuMGyAFCTRNBhmkSpjdqoZ
zhcgVlZeEI+qoVGkTzBNMQswCQYDVQQGEwJKUDERMA8GA1UECgwIY3Rvci5vcmcx
FDASBgNVBAsMC0RldmVsb3BtZW50MRUwEwYDVQQDDAxodHRwLWFjY2VzczKCAQEw
DQYJKoZIhvcNAQEFBQADgYEAH11tstSUuqFpMqoh/vM5l3Nqb8ygblbqEYQs/iG/
UeQkOZk/P1TxB6Ozn2htJ1srqDpUsncFVZ/ecP19GkeOZ6BmIhppcHhE5WyLBcPX
It5q1BW0PiAzT9LlEGoaiW0nw39so0Pr1whJDfc1t4fjdk+kSiMIzRHbTDvHWfpV
nTA=
-----END CERTIFICATE-----
END

cert = OpenSSL::X509::Certificate.new(pem_cert)
keyid = '24:D1:34:18:66:91:2A:63:76:AA:19:CE:17:20:56:56:5E:10:8F:AA'
cert.extensions.each do |ext|
value = ext.value
crit = ext.critical?
case ext.oid
when "keyUsage"
assert_equal true, crit
assert_equal "Certificate Sign, CRL Sign", value
when "basicConstraints"
assert_equal true, crit
assert_equal "CA:TRUE", value
when "authorityKeyIdentifier"
assert_equal false, crit
expected = "keyid:#{keyid}\n"
# NOTE: behavior matched against MRI 1.8.7/1.9.3/2.1.2 :
expected << "DirName:/C=JP/O=ctor.org/OU=Development/CN=http-access2\n"
expected << "serial:01\n"
assert_equal expected, value
when "subjectKeyIdentifier"
assert_equal false, crit
assert_equal keyid, value
when "nsComment"
assert_equal false, crit
assert_equal "Ruby/OpenSSL Generated Certificate", value
end
end
end

# JRUBY-5060
def test_to_pem_with_empty_object
empty_cert = "MCUwGwIAMAMGAQAwADAEHwAfADAAMAgwAwYBAAMBADADBgEAAwEA"
empty_req = "MBowEAIAMAAwCDADBgEAAwEAoAAwAwYBAAMBAA=="
empty_crl = "MBMwCTADBgEAMAAfADADBgEAAwEA"
empty_key = "MAA="
#assert_equal(empty_cert, OpenSSL::X509::Certificate.new.to_pem.split("\n")[1])
#assert_equal(empty_req, OpenSSL::X509::Request.new.to_pem.split("\n")[1])
#assert_equal(empty_crl, OpenSSL::X509::CRL.new.to_pem.split("\n")[1])
assert_nothing_raised do
OpenSSL::X509::Certificate.new.to_pem
end
assert_nothing_raised do
OpenSSL::X509::Request.new.to_pem
end
assert_nothing_raised do
OpenSSL::X509::CRL.new.to_pem
end
assert_equal(empty_key, OpenSSL::PKey::RSA.new.to_pem.split("\n")[1].chomp)
assert_equal(empty_key, OpenSSL::PKey::DSA.new.to_pem.split("\n")[1].chomp)
assert_equal(empty_key, OpenSSL::PKey::DH.new.to_pem.split("\n")[1].chomp)
end

# JRUBY-5096
def test_verify_failed_by_lazy_public_key_initialization
msg = 'hello,world'
digester = OpenSSL::Digest::SHA1.new
sig = @key.sign(digester, msg)
assert(@cert.public_key.verify(digester, sig, msg))
assert(@cert.verify(@cert.public_key))
end

# JRUBY-5253
def test_load_key_and_cert_in_one_file
file = File.read(File.expand_path('fixture/key_then_cert.pem', File.dirname(__FILE__)))
cert = OpenSSL::X509::Certificate.new(file)
key = OpenSSL::PKey::RSA.new(file)
assert_equal("Tue Dec 7 04:34:54 2010", cert.not_before.asctime)
assert_equal(155138628173305760586484923990788939560020632428367464748448028799529480209574373402763304069949574437177088605664104864141770364385183263453740781162330879666907894314877641447552442838727890327086630369910941911916802731723019019303432276515402934176273116832204529025371212188573318159421452591783377914839, key.n)
end

# JRUBY-5834
def test_ids_in_subject_rdn_set
cert_file = File.expand_path('fixture/ids_in_subject_rdn_set.pem', File.dirname(__FILE__))
cert = OpenSSL::X509::Certificate.new(File.read(cert_file))
keys = cert.subject.to_a.map { |k, v| k }.sort
assert_equal(10, keys.size)
assert_equal(true, keys.include?("CN"))
end

# jruby/jruby#152
def test_cert_init_from_file
cert_file = File.expand_path('fixture/ca-bundle.crt', File.dirname(__FILE__))
cert = OpenSSL::X509::Certificate.new(File.open(cert_file))

expected = [["C", "US", 19],
["ST", "DC", 19],
["L", "Washington", 19],
["O", "ABA.ECOM, INC.", 19],
["CN", "ABA.ECOM Root CA", 19]]

assert_equal expected, cert.subject.to_a[0..4]
end
end
9 changes: 1 addition & 8 deletions test/mri/excludes/OpenSSL/TestASN1.rb
Original file line number Diff line number Diff line change
@@ -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'
2 changes: 1 addition & 1 deletion test/mri/excludes/OpenSSL/TestCipher.rb
Original file line number Diff line number Diff line change
@@ -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'
2 changes: 0 additions & 2 deletions test/mri/excludes/OpenSSL/TestDigest.rb
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
exclude :test_digest_by_oid_and_name_sha2, 'Java exception raised'
exclude :test_openssl_digest, 'Java exception raised'
2 changes: 0 additions & 2 deletions test/mri/excludes/OpenSSL/TestX509Name.rb
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
exclude :test_spaceship, 'needs investigation'
exclude :test_unrecognized_oid, 'needs investigation'
2 changes: 1 addition & 1 deletion test/mri/excludes/OpenSSL/TestX509Request.rb
Original file line number Diff line number Diff line change
@@ -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'
9 changes: 7 additions & 2 deletions test/mri/openssl/test_asn1.rb
Original file line number Diff line number Diff line change
@@ -186,8 +186,13 @@ 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
21 changes: 21 additions & 0 deletions test/test_adding_pem_to_x509store.rb
Original file line number Diff line number Diff line change
@@ -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
p base = $LOAD_PATH.detect { |p| p =~ /ruby\/shared/ }
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