JRuby

Bad cast in jruby-openssl X509Utils

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: JRuby-OpenSSL 0.3
  • Fix Version/s: JRuby-OpenSSL 0.4
  • Component/s: OpenSSL
  • Labels:
    None
  • Number of attachments :
    1

Description

There appears to be a bad cast in the jruby-openssl code. A bug was reported that resulted in the following traces:

org.jruby.ext.openssl.impl.PKCS7Exception: PKCS7[Method: 117, Reason: 117]
org.jruby.ext.openssl.impl.PKCS7Exception: PKCS7[Method: 117, Reason: 117]
	at org.jruby.ext.openssl.impl.PKCS7.verify(PKCS7.java:353)
	at org.jruby.ext.openssl.PKCS7.verify(PKCS7.java:486)
	at org.jruby.ext.openssl.PKCS7$i_method_0_0$RUBYINVOKER$verify.call(org/jruby/ext/openssl/PKCS7$i_method_0_0$RUBYINVOKER$verify.gen)
	at org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:120)
	at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:292)
...
Caused by: java.lang.ClassCastException: org.bouncycastle.asn1.DERSequence
	at org.jruby.ext.openssl.x509store.X509Utils.checkIfIssuedBy(X509Utils.java:253)
	at org.jruby.ext.openssl.x509store.StoreContext$4.call(StoreContext.java:1100)
	at org.jruby.ext.openssl.x509store.StoreContext.verifyCertificate(StoreContext.java:666)
	at org.jruby.ext.openssl.impl.PKCS7.verify(PKCS7.java:341)

It appears that at this line a cast is made to X509Name, but what's actually coming out is a DERSequence.

This is a showstopper for a user, because it breaks HTTPClient and as a result they are unable to deploy their application.

Activity

Hide
Ola Bini added a comment -

The problem is that it doesn't break HTTPClient always. Specifically, it works very often - except when there is something strange in the certificate which makes the structure slightly different. To fix it I would need a test case against the specific https site that generated it.

That cast is valid most of the time, and more importantly I don't know the structure of that DERSequence until I can take a look at it.

Show
Ola Bini added a comment - The problem is that it doesn't break HTTPClient always. Specifically, it works very often - except when there is something strange in the certificate which makes the structure slightly different. To fix it I would need a test case against the specific https site that generated it. That cast is valid most of the time, and more importantly I don't know the structure of that DERSequence until I can take a look at it.
Hide
Anders Østergaard Jensen added a comment -

I experience exactly this problem when running JRuby 1.1.4 and Tomcat (6.0.18) on Mac OS X 10.5.4 with the vanilla Java 1.5 SDK shipping. I have the following gem versions installed:

actionmailer (2.1.1)
actionpack (2.1.1)
activerecord (2.1.1)
activerecord-jdbc-adapter (0.8.2)
activerecord-jdbcpostgresql-adapter (0.8.2)
activeresource (2.1.1)
activesupport (2.1.1)
fastercsv (1.4.0)
httpclient (2.1.2)
jdbc-postgres (8.2)
jruby-openssl (0.3)
rails (2.1.1)
rake (0.8.1)
rspec (1.1.4)
soap4r (1.5.8)
sources (0.0.1)
warbler (0.9.11)

When running jruby -S warble war from my RoR application directory, jruby-openssl yields a very odd, unexpected exception. The stack trace is included in the following pastie: http://pastie.org/270712

The '=> Testing XMIR connection and version' part is the output from environment.rb where a remote web service is invoked through soap4r. The error is repeated when running packaged application in Tomcat with an exactly similar stack trace.

I hope this comment may shed some light over this very odd case.

Show
Anders Østergaard Jensen added a comment - I experience exactly this problem when running JRuby 1.1.4 and Tomcat (6.0.18) on Mac OS X 10.5.4 with the vanilla Java 1.5 SDK shipping. I have the following gem versions installed: actionmailer (2.1.1) actionpack (2.1.1) activerecord (2.1.1) activerecord-jdbc-adapter (0.8.2) activerecord-jdbcpostgresql-adapter (0.8.2) activeresource (2.1.1) activesupport (2.1.1) fastercsv (1.4.0) httpclient (2.1.2) jdbc-postgres (8.2) jruby-openssl (0.3) rails (2.1.1) rake (0.8.1) rspec (1.1.4) soap4r (1.5.8) sources (0.0.1) warbler (0.9.11) When running jruby -S warble war from my RoR application directory, jruby-openssl yields a very odd, unexpected exception. The stack trace is included in the following pastie: http://pastie.org/270712 The '=> Testing XMIR connection and version' part is the output from environment.rb where a remote web service is invoked through soap4r. The error is repeated when running packaged application in Tomcat with an exactly similar stack trace. I hope this comment may shed some light over this very odd case.
Hide
Anders Østergaard Jensen added a comment -

It might be worth mentioning that the problem arises every time I load the soap4r gem and try to invoke any of the methods. The remote server is NOT accessed using https/TLS.

Best Regards.

Show
Anders Østergaard Jensen added a comment - It might be worth mentioning that the problem arises every time I load the soap4r gem and try to invoke any of the methods. The remote server is NOT accessed using https/TLS. Best Regards.
Hide
Charles Oliver Nutter added a comment -

Anders: toss an example line of code that does it...I'm not familiar with soap4r library.

Show
Charles Oliver Nutter added a comment - Anders: toss an example line of code that does it...I'm not familiar with soap4r library.
Hide
Ola Bini added a comment -

Hmm. If no remote access happens, the problem has got to be one of your local certificates, in your CAstore. Do you have anything in those that are not default?

Show
Ola Bini added a comment - Hmm. If no remote access happens, the problem has got to be one of your local certificates, in your CAstore. Do you have anything in those that are not default?
Hide
Jeff Stout added a comment -

For what it's worth, we're having the same problem with soap4r. It's yacking while trying to make a SOAP call.

Show
Jeff Stout added a comment - For what it's worth, we're having the same problem with soap4r. It's yacking while trying to make a SOAP call.
Hide
Jeff Stout added a comment -

Here's a sample. It's trying to fetch the WSDL file from opencalais.com and create the binding from it but it can't even get the WSDL.

require 'soap/wsdlDriver'
CALAIS_WSDL = 'http://api.opencalais.com/enlighten/?wsdl'
driver = SOAP::WSDLDriverFactory.new(CALAIS_WSDL).create_rpc_driver

org.jruby.ext.openssl.impl.PKCS7Exception: PKCS7[Method: 117, Reason: 117]
org.jruby.ext.openssl.impl.PKCS7Exception: PKCS7[Method: 117, Reason: 117]
at org.jruby.ext.openssl.impl.PKCS7.verify(PKCS7.java:353)
at org.jruby.ext.openssl.PKCS7.verify(PKCS7.java:486)
at org.jruby.ext.openssl.PKCS7$i_method_0_0$RUBYINVOKER$verify.call(org/jruby/ext/openssl/PKCS7$i_method_0_0$RUBYINVOKER$verify.gen)
at org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:120)
at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:292)
at org.jruby.ast.CallManyArgsNode.interpret(CallManyArgsNode.java:59)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101)
at org.jruby.ast.IfNode.interpret(IfNode.java:103)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101)
at org.jruby.ast.BlockNode.interpret(BlockNode.java:67)
at org.jruby.ast.IfNode.interpret(IfNode.java:108)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101)

Show
Jeff Stout added a comment - Here's a sample. It's trying to fetch the WSDL file from opencalais.com and create the binding from it but it can't even get the WSDL. require 'soap/wsdlDriver' CALAIS_WSDL = 'http://api.opencalais.com/enlighten/?wsdl' driver = SOAP::WSDLDriverFactory.new(CALAIS_WSDL).create_rpc_driver org.jruby.ext.openssl.impl.PKCS7Exception: PKCS7[Method: 117, Reason: 117] org.jruby.ext.openssl.impl.PKCS7Exception: PKCS7[Method: 117, Reason: 117] at org.jruby.ext.openssl.impl.PKCS7.verify(PKCS7.java:353) at org.jruby.ext.openssl.PKCS7.verify(PKCS7.java:486) at org.jruby.ext.openssl.PKCS7$i_method_0_0$RUBYINVOKER$verify.call(org/jruby/ext/openssl/PKCS7$i_method_0_0$RUBYINVOKER$verify.gen) at org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:120) at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:292) at org.jruby.ast.CallManyArgsNode.interpret(CallManyArgsNode.java:59) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101) at org.jruby.ast.IfNode.interpret(IfNode.java:103) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101) at org.jruby.ast.BlockNode.interpret(BlockNode.java:67) at org.jruby.ast.IfNode.interpret(IfNode.java:108) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101)
Hide
Jeff Stout added a comment -

It defiantly doesn't like the certs.

cacerts: /Applications/jruby-1.1.4/lib/ruby/gems/1.8/gems/httpclient-2.1.2/lib/httpclient/cacert.p7s loading failed

Show
Jeff Stout added a comment - It defiantly doesn't like the certs. cacerts: /Applications/jruby-1.1.4/lib/ruby/gems/1.8/gems/httpclient-2.1.2/lib/httpclient/cacert.p7s loading failed
Hide
Jeff Stout added a comment -

Here are a couple of good links explaining the problem and different fixes. Since nothing we do is over SSL i'm going to disable the CERT verification.

http://www.jkraemer.net/2007/7/27/soap4r-openssl-woes
http://groups.google.com/group/ruby-talk-google/browse_thread/thread/453f165d7fe63a8

Show
Jeff Stout added a comment - Here are a couple of good links explaining the problem and different fixes. Since nothing we do is over SSL i'm going to disable the CERT verification. http://www.jkraemer.net/2007/7/27/soap4r-openssl-woes http://groups.google.com/group/ruby-talk-google/browse_thread/thread/453f165d7fe63a8
Hide
Paul Fraser added a comment -

Similar problem is occurring with examples from Ruby Cookbook recipe 16.4 and also soap4r examples Hello World etc.
MRI platform (1.8.6 p0) has no error but JRuby/Netbeans build 4009 produces (for Hello World Example)

org.jruby.ext.openssl.impl.PKCS7Exception: PKCS7[Method: 117, Reason: 117]

org.jruby.ext.openssl.impl.PKCS7Exception: PKCS7[Method: 117, Reason: 117]

at org.jruby.ext.openssl.impl.PKCS7.verify(PKCS7.java:353)

at org.jruby.ext.openssl.PKCS7.verify(PKCS7.java:486)

at org.jruby.ext.openssl.PKCS7$i_method_0_0$RUBYINVOKER$verify.call(org/jruby/ext/openssl/PKCS7$i_method_0_0$RUBYINVOKER$verify.gen)

at org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:120)

at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:292)

at org.jruby.ast.CallManyArgsNode.interpret(CallManyArgsNode.java:59)

at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101)

at org.jruby.ast.IfNode.interpret(IfNode.java:103)

at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101)

at org.jruby.ast.BlockNode.interpret(BlockNode.java:67)

at org.jruby.ast.IfNode.interpret(IfNode.java:108)

at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101)

at org.jruby.ast.BlockNode.interpret(BlockNode.java:67)

at org.jruby.internal.runtime.methods.DefaultMethod.interpretedCall(DefaultMethod.java:163)

at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:140)

at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:211)

at org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:132)

at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:343)

at org.jruby.ast.VCallNode.interpret(VCallNode.java:82)

at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101)

at org.jruby.ast.BlockNode.interpret(BlockNode.java:67)

at org.jruby.internal.runtime.methods.DefaultMethod.interpretedCall(DefaultMethod.java:163)

at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:140)

at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:274)

at org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:168)

at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:406)

at org.jruby.RubyClass$SpecificArityNew.call(RubyClass.java:545)

at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:151)

at org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:156)

at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:394)

at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)

at org.jruby.ast.InstAsgnNode.interpret(InstAsgnNode.java:88)

at org.jruby.ast.AttrAssignOneArgNode.interpret(AttrAssignOneArgNode.java:32)

at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101)

at org.jruby.ast.BlockNode.interpret(BlockNode.java:67)

at org.jruby.internal.runtime.methods.DefaultMethod.interpretedCall(DefaultMethod.java:163)

at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:140)

at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:316)

at org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:192)

at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:457)

at org.jruby.RubyClass$SpecificArityNew.call(RubyClass.java:551)

at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:168)

at org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:180)

at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:445)

at org.jruby.ast.CallTwoArgNode.interpret(CallTwoArgNode.java:59)

at org.jruby.ast.InstAsgnNode.interpret(InstAsgnNode.java:88)

at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101)

at org.jruby.ast.BlockNode.interpret(BlockNode.java:67)

at org.jruby.internal.runtime.methods.DefaultMethod.interpretedCall(DefaultMethod.java:163)

at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:140)

at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:274)

at org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:168)

at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:406)

at org.jruby.RubyClass$SpecificArityNew.call(RubyClass.java:545)

at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:151)

at org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:156)

at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:394)

at org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36)

at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101)

at org.jruby.internal.runtime.methods.DefaultMethod.interpretedCall(DefaultMethod.java:163)

at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:140)

at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:253)

at org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:156)

at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:394)

at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)

at org.jruby.ast.InstAsgnNode.interpret(InstAsgnNode.java:88)

at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101)

at org.jruby.ast.BlockNode.interpret(BlockNode.java:67)

at org.jruby.internal.runtime.methods.DefaultMethod.interpretedCall(DefaultMethod.java:163)

at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:140)

at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:253)

at org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:156)

at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:394)

at org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36)

at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101)

at org.jruby.ast.BlockNode.interpret(BlockNode.java:67)

at org.jruby.internal.runtime.methods.DefaultMethod.interpretedCall(DefaultMethod.java:163)

at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:140)

at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:358)

at org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:216)

at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:508)

at org.jruby.RubyClass$SpecificArityNew.call(RubyClass.java:557)

at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:186)

at org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:204)

at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:496)

at org.jruby.ast.CallThreeArgNode.interpret(CallThreeArgNode.java:61)

at org.jruby.ast.InstAsgnNode.interpret(InstAsgnNode.java:88)

at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101)

at org.jruby.ast.BlockNode.interpret(BlockNode.java:67)

at org.jruby.internal.runtime.methods.DefaultMethod.interpretedCall(DefaultMethod.java:163)

at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:140)

at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:316)

at org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:192)

at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:457)

at org.jruby.RubyClass$SpecificArityNew.call(RubyClass.java:551)

at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:168)

at org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:180)

at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:445)

at C_3a_.Users.paulAdmin.Documents.NetbeansProjects.soap_play_1_0.lib.main._file_(main.rb:5)

at C_3a_.Users.paulAdmin.Documents.NetbeansProjects.soap_play_1_0.lib.main._file_(main.rb)

at C_3a_.Users.paulAdmin.Documents.NetbeansProjects.soap_play_1_0.lib.main.load(main.rb)

at org.jruby.Ruby.runScript(Ruby.java:544)

at org.jruby.Ruby.runNormally(Ruby.java:457)

at org.jruby.Ruby.runFromMain(Ruby.java:330)

at org.jruby.Main.run(Main.java:214)

at org.jruby.Main.run(Main.java:100)

at org.jruby.Main.main(Main.java:84)

Caused by: java.lang.ClassCastException: org.bouncycastle.asn1.DERSequence cannot be cast to org.bouncycastle.asn1.x509.X509Name

at org.jruby.ext.openssl.x509store.X509Utils.checkIfIssuedBy(X509Utils.java:253)

at org.jruby.ext.openssl.x509store.StoreContext$4.call(StoreContext.java:1100)

at org.jruby.ext.openssl.x509store.StoreContext.verifyCertificate(StoreContext.java:666)

at org.jruby.ext.openssl.impl.PKCS7.verify(PKCS7.java:341)

... 106 more

cacerts: C:/Users/paulAdmin/Documents/Netbeans/netbeans-hudson-trunk-4009-ruby/netbeans/ruby2/jruby-1.1.4/lib/ruby/gems/1.8/gems/httpclient-2.1.2/lib/httpclient/cacert.p7s loading failed
"Hello World, from main"

Show
Paul Fraser added a comment - Similar problem is occurring with examples from Ruby Cookbook recipe 16.4 and also soap4r examples Hello World etc. MRI platform (1.8.6 p0) has no error but JRuby/Netbeans build 4009 produces (for Hello World Example) org.jruby.ext.openssl.impl.PKCS7Exception: PKCS7[Method: 117, Reason: 117] org.jruby.ext.openssl.impl.PKCS7Exception: PKCS7[Method: 117, Reason: 117] at org.jruby.ext.openssl.impl.PKCS7.verify(PKCS7.java:353) at org.jruby.ext.openssl.PKCS7.verify(PKCS7.java:486) at org.jruby.ext.openssl.PKCS7$i_method_0_0$RUBYINVOKER$verify.call(org/jruby/ext/openssl/PKCS7$i_method_0_0$RUBYINVOKER$verify.gen) at org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:120) at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:292) at org.jruby.ast.CallManyArgsNode.interpret(CallManyArgsNode.java:59) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101) at org.jruby.ast.IfNode.interpret(IfNode.java:103) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101) at org.jruby.ast.BlockNode.interpret(BlockNode.java:67) at org.jruby.ast.IfNode.interpret(IfNode.java:108) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101) at org.jruby.ast.BlockNode.interpret(BlockNode.java:67) at org.jruby.internal.runtime.methods.DefaultMethod.interpretedCall(DefaultMethod.java:163) at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:140) at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:211) at org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:132) at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:343) at org.jruby.ast.VCallNode.interpret(VCallNode.java:82) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101) at org.jruby.ast.BlockNode.interpret(BlockNode.java:67) at org.jruby.internal.runtime.methods.DefaultMethod.interpretedCall(DefaultMethod.java:163) at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:140) at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:274) at org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:168) at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:406) at org.jruby.RubyClass$SpecificArityNew.call(RubyClass.java:545) at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:151) at org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:156) at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:394) at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57) at org.jruby.ast.InstAsgnNode.interpret(InstAsgnNode.java:88) at org.jruby.ast.AttrAssignOneArgNode.interpret(AttrAssignOneArgNode.java:32) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101) at org.jruby.ast.BlockNode.interpret(BlockNode.java:67) at org.jruby.internal.runtime.methods.DefaultMethod.interpretedCall(DefaultMethod.java:163) at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:140) at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:316) at org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:192) at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:457) at org.jruby.RubyClass$SpecificArityNew.call(RubyClass.java:551) at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:168) at org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:180) at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:445) at org.jruby.ast.CallTwoArgNode.interpret(CallTwoArgNode.java:59) at org.jruby.ast.InstAsgnNode.interpret(InstAsgnNode.java:88) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101) at org.jruby.ast.BlockNode.interpret(BlockNode.java:67) at org.jruby.internal.runtime.methods.DefaultMethod.interpretedCall(DefaultMethod.java:163) at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:140) at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:274) at org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:168) at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:406) at org.jruby.RubyClass$SpecificArityNew.call(RubyClass.java:545) at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:151) at org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:156) at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:394) at org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101) at org.jruby.internal.runtime.methods.DefaultMethod.interpretedCall(DefaultMethod.java:163) at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:140) at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:253) at org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:156) at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:394) at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57) at org.jruby.ast.InstAsgnNode.interpret(InstAsgnNode.java:88) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101) at org.jruby.ast.BlockNode.interpret(BlockNode.java:67) at org.jruby.internal.runtime.methods.DefaultMethod.interpretedCall(DefaultMethod.java:163) at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:140) at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:253) at org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:156) at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:394) at org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101) at org.jruby.ast.BlockNode.interpret(BlockNode.java:67) at org.jruby.internal.runtime.methods.DefaultMethod.interpretedCall(DefaultMethod.java:163) at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:140) at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:358) at org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:216) at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:508) at org.jruby.RubyClass$SpecificArityNew.call(RubyClass.java:557) at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:186) at org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:204) at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:496) at org.jruby.ast.CallThreeArgNode.interpret(CallThreeArgNode.java:61) at org.jruby.ast.InstAsgnNode.interpret(InstAsgnNode.java:88) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101) at org.jruby.ast.BlockNode.interpret(BlockNode.java:67) at org.jruby.internal.runtime.methods.DefaultMethod.interpretedCall(DefaultMethod.java:163) at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:140) at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:316) at org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:192) at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:457) at org.jruby.RubyClass$SpecificArityNew.call(RubyClass.java:551) at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:168) at org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:180) at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:445) at C_3a_.Users.paulAdmin.Documents.NetbeansProjects.soap_play_1_0.lib.main._file_(main.rb:5) at C_3a_.Users.paulAdmin.Documents.NetbeansProjects.soap_play_1_0.lib.main._file_(main.rb) at C_3a_.Users.paulAdmin.Documents.NetbeansProjects.soap_play_1_0.lib.main.load(main.rb) at org.jruby.Ruby.runScript(Ruby.java:544) at org.jruby.Ruby.runNormally(Ruby.java:457) at org.jruby.Ruby.runFromMain(Ruby.java:330) at org.jruby.Main.run(Main.java:214) at org.jruby.Main.run(Main.java:100) at org.jruby.Main.main(Main.java:84) Caused by: java.lang.ClassCastException: org.bouncycastle.asn1.DERSequence cannot be cast to org.bouncycastle.asn1.x509.X509Name at org.jruby.ext.openssl.x509store.X509Utils.checkIfIssuedBy(X509Utils.java:253) at org.jruby.ext.openssl.x509store.StoreContext$4.call(StoreContext.java:1100) at org.jruby.ext.openssl.x509store.StoreContext.verifyCertificate(StoreContext.java:666) at org.jruby.ext.openssl.impl.PKCS7.verify(PKCS7.java:341) ... 106 more cacerts: C:/Users/paulAdmin/Documents/Netbeans/netbeans-hudson-trunk-4009-ruby/netbeans/ruby2/jruby-1.1.4/lib/ruby/gems/1.8/gems/httpclient-2.1.2/lib/httpclient/cacert.p7s loading failed "Hello World, from main"
Hide
Charles Oliver Nutter added a comment -

Unfortunately we still have no good direction to take on this one. We could really use someone who knows encryption inside and out and who's willing to dive into JRuby's OpenSSL lib.

Show
Charles Oliver Nutter added a comment - Unfortunately we still have no good direction to take on this one. We could really use someone who knows encryption inside and out and who's willing to dive into JRuby's OpenSSL lib.
Hide
Danny Brain added a comment -

I reverted to a caveman and ran around wielding my delete key (that's right, cavemen had delete keys). Seems if I remove <jruby_home>/lib/ruby/gems/1.8/gems/httpclient-2.1.2/lib/httpclient/cacert.p7s I no longer get this error and things work.

Further to this attempting to view the certificate information for cacert.p7s (using some SOE certificate reader on this windows box) gave me a "This is not a valid certificate" error. To be fair that is probably just some dodgy SOE software though.

Will test further.

Show
Danny Brain added a comment - I reverted to a caveman and ran around wielding my delete key (that's right, cavemen had delete keys). Seems if I remove <jruby_home>/lib/ruby/gems/1.8/gems/httpclient-2.1.2/lib/httpclient/cacert.p7s I no longer get this error and things work. Further to this attempting to view the certificate information for cacert.p7s (using some SOE certificate reader on this windows box) gave me a "This is not a valid certificate" error. To be fair that is probably just some dodgy SOE software though. Will test further.
Hide
Charles Oliver Nutter added a comment -

Well it's sounding like there's an issue with the ca cert whipped with httpclient. Hopefully you'll be able to confirm that and get back to us...

Show
Charles Oliver Nutter added a comment - Well it's sounding like there's an issue with the ca cert whipped with httpclient. Hopefully you'll be able to confirm that and get back to us...
Hide
Danny Brain added a comment -

Sorry for the late response.
I don't think it's the certificate, just the way Jruby-openssl is trying to parse it. To test this I replaced the cacert.p7s with some other random p7s files google threw at me, same stacktrace (albeit not a great test).

Show
Danny Brain added a comment - Sorry for the late response. I don't think it's the certificate, just the way Jruby-openssl is trying to parse it. To test this I replaced the cacert.p7s with some other random p7s files google threw at me, same stacktrace (albeit not a great test).
Hide
Justin Coyne added a comment -

src/java/org/jruby/ext/openssl/x509store/X509Utils.java

253: < nm = (X509Name)gens[i].getName();


253: > nm = new X509Name((DERSequence) gens[i].getName());

Possible fix. Please test critically.

Show
Justin Coyne added a comment - src/java/org/jruby/ext/openssl/x509store/X509Utils.java 253: < nm = (X509Name)gens[i].getName();
253: > nm = new X509Name((DERSequence) gens[i].getName()); Possible fix. Please test critically.
Hide
Justin Coyne added a comment -

Seems to fix the problem when using soap4j

Show
Justin Coyne added a comment - Seems to fix the problem when using soap4j
Hide
Justin Coyne added a comment -

A possible fix for this problem. This seems to rectify the error when using httpclient via soap4r.

Show
Justin Coyne added a comment - A possible fix for this problem. This seems to rectify the error when using httpclient via soap4r.
Hide
Charles Oliver Nutter added a comment -

I fixed this by adding an instanceof check, since it appears from the code that both X509Name and DERSequence are potentially valid results of the getName call in question. This should hopefully resolve everyone's issues; if it does not, open a new bug please.

Show
Charles Oliver Nutter added a comment - I fixed this by adding an instanceof check, since it appears from the code that both X509Name and DERSequence are potentially valid results of the getName call in question. This should hopefully resolve everyone's issues; if it does not, open a new bug please.

People

Vote (5)
Watch (7)

Dates

  • Created:
    Updated:
    Resolved: