Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: JRuby-OSSL 0.7.4, JRuby 1.6.3
    • Fix Version/s: JRuby-OSSL 0.7.5
    • Component/s: OpenSSL
    • Labels:
      None
    • Environment:
      OSX Lion
    • Number of attachments :
      0

      Description

      require 'openssl'
      OpenSSL::PKCS7.new
      
      Java::JavaLang::NullPointerException: 
      	from org.jruby.ext.openssl.PKCS7.to_pem(PKCS7.java:560)
      	from org.jruby.ext.openssl.PKCS7$i$0$0$to_pem.call(PKCS7$i$0$0$to_pem.gen:65535)
      	from org.jruby.RubyClass.finvoke(RubyClass.java:618)
      	from org.jruby.javasupport.util.RuntimeHelpers.invoke(RuntimeHelpers.java:545)
      	from org.jruby.RubyBasicObject.inspect(RubyBasicObject.java:1060)
      	from org.jruby.RubyKernel.inspect(RubyKernel.java:1944)
      	from org.jruby.RubyKernel$s$0$0$inspect.call(RubyKernel$s$0$0$inspect.gen:65535)
      	from org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:262)
      	from org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:105)
      	from org.jruby.ast.CallNoArgNode.interpret(CallNoArgNode.java:63)
      	from org.jruby.ast.FCallTwoArgNode.interpret(FCallTwoArgNode.java:38)
      	from org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
      	from org.jruby.ast.IfNode.interpret(IfNode.java:117)
      	from org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
      	from org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:75)
      	from org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:147)
      ... 103 levels...
      	from org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
      	from org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:75)
      	from org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:190)
      	from org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:179)
      	from org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:282)
      	from org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:139)
      

        Activity

        Hide
        David Lee added a comment -

        Actually, it seems like it's a bug with to_pem() that was triggered because the example code was run in IRB, which tried to output the blank PKCS7.

        Show
        David Lee added a comment - Actually, it seems like it's a bug with to_pem() that was triggered because the example code was run in IRB, which tried to output the blank PKCS7.
        Hide
        Charles Oliver Nutter added a comment -

        Interesting. It looks like initialize bails out without initializing the "p7" field that triggers this bug whenever there's no arguments passed. There's lots of places that are using p7 field blind too. I may patch this temporarily with just an error that we haven't initialized properly or something. Will check what MRI does.

        Show
        Charles Oliver Nutter added a comment - Interesting. It looks like initialize bails out without initializing the "p7" field that triggers this bug whenever there's no arguments passed. There's lots of places that are using p7 field blind too. I may patch this temporarily with just an error that we haven't initialized properly or something. Will check what MRI does.
        Hide
        Charles Oliver Nutter added a comment -

        On second thought I'm not sure what the default behavior actually does. I'm no crypto guy.

        system ~ $ irb
        >> require 'openssl'
        => true
        >> OpenSSL::PKCS7.new
        => -----BEGIN PKCS7-----
        MAMGAQA=
        -----END PKCS7-----
        
        Show
        Charles Oliver Nutter added a comment - On second thought I'm not sure what the default behavior actually does. I'm no crypto guy. system ~ $ irb >> require 'openssl' => true >> OpenSSL::PKCS7.new => -----BEGIN PKCS7----- MAMGAQA= -----END PKCS7-----
        Hide
        David Lee added a comment -

        I sent in a pull request that fixes this: https://github.com/jruby/jruby-ossl/pull/9

        Show
        David Lee added a comment - I sent in a pull request that fixes this: https://github.com/jruby/jruby-ossl/pull/9
        Hide
        David Lee added a comment -

        Actually, those are fixes for other bugs. This bug remains broken.

        Show
        David Lee added a comment - Actually, those are fixes for other bugs. This bug remains broken.
        Hide
        Hiroshi Nakamura added a comment -

        Formatting

        Show
        Hiroshi Nakamura added a comment - Formatting
        Hide
        Hiroshi Nakamura added a comment -

        Fixed.

        commit 887d1810e25090391893de3b3eb31c68b8418774
        Author: Hiroshi Nakamura <nahi@ruby-lang.org>
        Date:   Thu Sep 8 15:07:53 2011 +0900
        
            JRUBY-5972: allow to load/dump empty PKCS7 data
            
            OpenSSL seems to allow to dump empty PKCS7 data which has "0.0" as an
            ObjectId. Follow it.
        

        I just fixed PKCS7.new.to_der prolem. As the pull request David gave us (thanks!), (thanks!), we still have unimplemented methods of PKCS7 object. For those methods, I need a test or an use-case for the fix as I added as a comment to pull request. I'll handle that as a different issue.

        Closing.

        Show
        Hiroshi Nakamura added a comment - Fixed. commit 887d1810e25090391893de3b3eb31c68b8418774 Author: Hiroshi Nakamura <nahi@ruby-lang.org> Date: Thu Sep 8 15:07:53 2011 +0900 JRUBY-5972: allow to load/dump empty PKCS7 data OpenSSL seems to allow to dump empty PKCS7 data which has "0.0" as an ObjectId. Follow it. I just fixed PKCS7.new.to_der prolem. As the pull request David gave us (thanks!), (thanks!), we still have unimplemented methods of PKCS7 object. For those methods, I need a test or an use-case for the fix as I added as a comment to pull request. I'll handle that as a different issue. Closing.

          People

          • Assignee:
            Hiroshi Nakamura
            Reporter:
            David Lee
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: