ActiveMerchant's AuthorizeNet Gateway throws OpenSSL Cert Validation Error, 
when there should be no error
---------------------------------------------------------------------------------------------------------

                 Key: JRUBY-3570
                 URL: http://jira.codehaus.org/browse/JRUBY-3570
             Project: JRuby
          Issue Type: Bug
          Components: OpenSSL
    Affects Versions: JRuby-OpenSSL 0.4, JRuby 1.2, JRuby 1.1.6
         Environment: Mac OS X Leopard (Macbook Pro Penryn), MacPorts-installed 
JRuby
            Reporter: Preston Marshall
             Fix For: JRuby-OpenSSL 0.5


When testing out some sample code with the Authorize.net gateway for 
activemerchant, i get an OpenSSL Error: 
java.lang.ClassCastException: org.bouncycastle.asn1.DEROctetString
        at org.jruby.ext.openssl.x509store.Purpose$1.call(Purpose.java:305)
        at org.jruby.ext.openssl.x509store.Purpose.checkPurpose(Purpose.java:80)
        at 
org.jruby.ext.openssl.x509store.StoreContext.checkChainExtensions(StoreContext.java:897)
        at 
org.jruby.ext.openssl.x509store.StoreContext.verifyCertificate(StoreContext.java:760)
        at 
org.jruby.ext.openssl.SSLContext$TM.checkServerTrusted(SSLContext.java:295)
        at 
com.sun.net.ssl.internal.ssl.JsseX509TrustManager.checkServerTrusted(SSLContextImpl.java:320)
        at 
com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:841)
        at 
com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:106)
        at 
com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:495)
        at com.sun.net.ssl.internal.ssl.Handshaker$1.run(Handshaker.java:437)
        at java.security.AccessController.doPrivileged(Native Method)
        at 
com.sun.net.ssl.internal.ssl.Handshaker$DelegatedTask.run(Handshaker.java:932)
        at org.jruby.ext.openssl.SSLSocket.doTasks(SSLSocket.java:280)
        at org.jruby.ext.openssl.SSLSocket.doHandshake(SSLSocket.java:256)
        at org.jruby.ext.openssl.SSLSocket.connect(SSLSocket.java:176)
        at 
org.jruby.ext.openssl.SSLSocket$i_method_0_0$RUBYINVOKER$connect.call(org/jruby/ext/openssl/SSLSocket$i_method_0_0$RUBYINVOKER$connect.gen)
        at 
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:253)
        at 
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:72)
        at org.jruby.ast.CallNoArgNode.interpret(CallNoArgNode.java:61)
        at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
        at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
        at org.jruby.ast.IfNode.interpret(IfNode.java:112)
        at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
        at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
        at 
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:125)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:126)
        at 
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:253)
        at 
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:72)
        at org.jruby.ast.VCallNode.interpret(VCallNode.java:85)
        at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
        at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
        at 
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:125)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:126)
        at 
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:253)
        at 
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:72)
        at org.jruby.ast.VCallNode.interpret(VCallNode.java:85)
        at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
        at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
        at org.jruby.ast.EnsureNode.interpret(EnsureNode.java:96)
        at org.jruby.ast.BeginNode.interpret(BeginNode.java:83)
        at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
        at org.jruby.ast.IfNode.interpret(IfNode.java:112)
        at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
        at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
        at 
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:144)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:135)
        at 
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:263)
        at 
org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:81)
        at 
org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:96)
        at 
org.jruby.ast.FCallNoArgBlockNode.interpret(FCallNoArgBlockNode.java:32)
        at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
        at org.jruby.ast.IfNode.interpret(IfNode.java:114)
        at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
        at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
        at 
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:220)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:171)
        at 
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:303)
        at 
org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:161)
        at 
org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:176)
        at 
org.jruby.ast.FCallTwoArgBlockNode.interpret(FCallTwoArgBlockNode.java:34)
        at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
        at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
        at 
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:239)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:180)
        at 
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:313)
        at 
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:192)
        at org.jruby.ast.CallThreeArgNode.interpret(CallThreeArgNode.java:61)
        at org.jruby.ast.CallNoArgNode.interpret(CallNoArgNode.java:61)
        at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
        at org.jruby.ast.RescueNode.executeBody(RescueNode.java:225)
        at 
org.jruby.ast.RescueNode.interpretWithJavaExceptions(RescueNode.java:147)
        at org.jruby.ast.RescueNode.interpret(RescueNode.java:110)
        at org.jruby.ast.BeginNode.interpret(BeginNode.java:83)
        at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
        at 
org.jruby.runtime.InterpretedBlock.evalBlockBody(InterpretedBlock.java:192)
        at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:143)
        at org.jruby.runtime.Block.yield(Block.java:100)
        at org.jruby.ast.YieldNode.interpret(YieldNode.java:115)
        at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
        at org.jruby.ast.RescueNode.executeBody(RescueNode.java:225)
        at 
org.jruby.ast.RescueNode.interpretWithJavaExceptions(RescueNode.java:147)
        at org.jruby.ast.RescueNode.interpret(RescueNode.java:110)
        at org.jruby.ast.BeginNode.interpret(BeginNode.java:83)
        at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
        at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
        at 
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:144)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:135)
        at 
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:263)
        at 
org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:81)
        at 
org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:96)
        at 
org.jruby.ast.FCallNoArgBlockNode.interpret(FCallNoArgBlockNode.java:32)
        at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
        at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
        at 
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:201)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:162)
        at 
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:293)
        at 
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:152)
        at org.jruby.ast.FCallTwoArgNode.interpret(FCallTwoArgNode.java:38)
        at org.jruby.ast.LocalAsgnNode.interpret(LocalAsgnNode.java:123)
        at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
        at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
        at 
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:239)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:180)
        at 
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:313)
        at 
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:192)
        at org.jruby.ast.FCallThreeArgNode.interpret(FCallThreeArgNode.java:40)
        at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
        at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
        at 
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:201)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:162)
        at 
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:293)
        at 
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:152)
        at Users.hoss.am_minus_test.__file__(am-test.rb:28)
        at Users.hoss.am_minus_test.load(am-test.rb)
        at org.jruby.Ruby.runScript(Ruby.java:577)
        at org.jruby.Ruby.runNormally(Ruby.java:480)
        at org.jruby.Ruby.runFromMain(Ruby.java:354)
        at org.jruby.Main.run(Main.java:229)
        at org.jruby.Main.run(Main.java:110)
        at org.jruby.Main.main(Main.java:94)
/opt/local/share/java/jruby/lib/ruby/1.8/net/http.rb:590:in `connect': 
certificate verify failed (OpenSSL::SSL::SSLError)
        from /opt/local/share/java/jruby/lib/ruby/1.8/net/http.rb:557:in 
`do_start'
        from /opt/local/share/java/jruby/lib/ruby/1.8/net/http.rb:546:in `start'
        from /opt/local/share/java/jruby/lib/ruby/1.8/net/http.rb:1044:in 
`request'
        from /opt/local/share/java/jruby/lib/ruby/1.8/net/http.rb:854:in `post'
        from 
/opt/local/share/java/jruby/lib/ruby/gems/1.8/gems/activemerchant-1.4.1/lib/active_merchant/lib/posts_data.rb:61:in
 `ssl_post'
        from 
/opt/local/share/java/jruby/lib/ruby/gems/1.8/gems/activemerchant-1.4.1/lib/active_merchant/lib/posts_data.rb:77:in
 `retry_exceptions'
        from 
/opt/local/share/java/jruby/lib/ruby/gems/1.8/gems/activemerchant-1.4.1/lib/active_merchant/lib/posts_data.rb:59:in
 `ssl_post'
        from 
/opt/local/share/java/jruby/lib/ruby/gems/1.8/gems/activemerchant-1.4.1/lib/active_merchant/billing/gateways/authorize_net.rb:235:in
 `commit'
        from 
/opt/local/share/java/jruby/lib/ruby/gems/1.8/gems/activemerchant-1.4.1/lib/active_merchant/billing/gateways/authorize_net.rb:107:in
 `purchase'


The code I'm running is here: http://pasternak.superalloy.nl/pastes/2009

Headius fixed the problem, and his patch is located here, but I believe he 
wants someone with more knowledge of the "lightly documented" code to look at 
it: http://pastie.org/446800

Thanks!



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to