Brice Figureau created JRUBY-6347:
-------------------------------------

             Summary: Error when creating X509 Request from PEM generated by 
MRI 1.8.7 and Puppet
                 Key: JRUBY-6347
                 URL: https://jira.codehaus.org/browse/JRUBY-6347
             Project: JRuby
          Issue Type: Bug
          Components: OpenSSL
    Affects Versions: JRuby-OSSL 0.7.4
         Environment: mac osx 10.6, jruby HEAD, jruby-ossl 0.7.4, Puppet 2.7.9
            Reporter: Brice Figureau
            Priority: Minor
         Attachments: 0001-Fix-PEM-format-parsing-of-CSR.patch, attr.rb

While trying to run Puppet under JRuby on a blank installation (so that Puppet 
will create CSR with attributes), I found that it fails when trying to reload 
an X509 Request from a PEM file created earlier (through JRuby or MRI).

Here is the error:
{code}
Request.java:143:in `_initialize': java.lang.ClassCastException: 
org.bouncycastle.asn1.DERSequence cannot be cast to org.bouncycastle.asn1.DERSet
        from Request$INVOKER$i$0$0$_initialize.gen:65535:in `call'
        from DynamicMethod.java:216:in `call'
        from CachingCallSite.java:176:in `callBlock'
        from CachingCallSite.java:182:in `call'
        from RubyClass.java:817:in `newInstance'
        from RubyClass$INVOKER$i$newInstance.gen:65535:in `call'
        from JavaMethod.java:273:in `call'
        from CachingCallSite.java:312:in `cacheAndCall'
        from CachingCallSite.java:169:in `call'
        from CallOneArgNode.java:57:in `interpret'
        from InstAsgnNode.java:95:in `interpret'
        from NewlineNode.java:104:in `interpret'
        from ASTInterpreter.java:75:in `INTERPRET_METHOD'
        from InterpretedMethod.java:190:in `call'
        from DefaultMethod.java:199:in `call'
        from CachingCallSite.java:312:in `cacheAndCall'
        from CachingCallSite.java:169:in `call'
        from CallOneArgNode.java:57:in `interpret'
        from NewlineNode.java:104:in `interpret'
        from BlockNode.java:71:in `interpret'
        from ASTInterpreter.java:75:in `INTERPRET_METHOD'
        from InterpretedMethod.java:190:in `call'
        from DefaultMethod.java:199:in `call'
        from CachingCallSite.java:312:in `cacheAndCall'
        from CachingCallSite.java:169:in `call'
        from CallOneArgNode.java:57:in `interpret'
        from LocalAsgnNode.java:123:in `interpret'
        from AndNode.java:95:in `interpret'
        from IfNode.java:111:in `interpret'
        from NewlineNode.java:104:in `interpret'
        from BlockNode.java:71:in `interpret'
        from RescueNode.java:216:in `executeBody'
        from RescueNode.java:120:in `interpretWithJavaExceptions'
        from RescueNode.java:110:in `interpret'
        from ASTInterpreter.java:75:in `INTERPRET_METHOD'
        from InterpretedMethod.java:190:in `call'
        from DefaultMethod.java:199:in `call'
        from CachingCallSite.java:312:in `cacheAndCall'
        from CachingCallSite.java:169:in `call'
        from FCallOneArgNode.java:36:in `interpret'
        from LocalAsgnNode.java:123:in `interpret'
        from IfNode.java:111:in `interpret'
        from NewlineNode.java:104:in `interpret'
        from BlockNode.java:71:in `interpret'
        from ASTInterpreter.java:75:in `INTERPRET_METHOD'
        from InterpretedMethod.java:190:in `call'
        from DefaultMethod.java:199:in `call'
        from CachingCallSite.java:312:in `cacheAndCall'
        from CachingCallSite.java:169:in `call'
        from CallOneArgNode.java:57:in `interpret'
        from LocalAsgnNode.java:123:in `interpret'
        from IfNode.java:111:in `interpret'
        from NewlineNode.java:104:in `interpret'
        from BlockNode.java:71:in `interpret'
        from IfNode.java:119:in `interpret'
        from NewlineNode.java:104:in `interpret'
        from BlockNode.java:71:in `interpret'
        from ASTInterpreter.java:75:in `INTERPRET_METHOD'
        from InterpretedMethod.java:233:in `call'
        from DefaultMethod.java:215:in `call'
        from CachingCallSite.java:332:in `cacheAndCall'
        from CachingCallSite.java:203:in `call'
        from CallTwoArgNode.java:59:in `interpret'
        from NewlineNode.java:104:in `interpret'
        from IfNode.java:117:in `interpret'
        from NewlineNode.java:104:in `interpret'
        from BlockNode.java:71:in `interpret'
        from ASTInterpreter.java:75:in `INTERPRET_METHOD'
        from InterpretedMethod.java:147:in `call'
        from DefaultMethod.java:183:in `call'
        from CachingCallSite.java:292:in `cacheAndCall'
        from CachingCallSite.java:135:in `call'
        from CallNoArgNode.java:63:in `interpret'
        from IfNode.java:119:in `interpret'
        from NewlineNode.java:104:in `interpret'
        from BlockNode.java:71:in `interpret'
        from ASTInterpreter.java:75:in `INTERPRET_METHOD'
        from InterpretedMethod.java:147:in `call'
        from DefaultMethod.java:183:in `call'
        from CachingCallSite.java:292:in `cacheAndCall'
        from CachingCallSite.java:135:in `call'
        from CallNoArgNode.java:63:in `interpret'
        from NewlineNode.java:104:in `interpret'
        from BlockNode.java:71:in `interpret'
        from ASTInterpreter.java:75:in `INTERPRET_METHOD'
        from InterpretedMethod.java:147:in `call'
        from DefaultMethod.java:183:in `call'
        from CachingCallSite.java:292:in `cacheAndCall'
        from CachingCallSite.java:135:in `call'
        from VCallNode.java:86:in `interpret'
        from NewlineNode.java:104:in `interpret'
        from IfNode.java:119:in `interpret'
        from NewlineNode.java:104:in `interpret'
        from ASTInterpreter.java:75:in `INTERPRET_METHOD'
        from InterpretedMethod.java:147:in `call'
        from DefaultMethod.java:183:in `call'
        from CachingCallSite.java:292:in `cacheAndCall'
        from CachingCallSite.java:135:in `call'
        from VCallNode.java:86:in `interpret'
        from NewlineNode.java:104:in `interpret'
        from ASTInterpreter.java:112:in `INTERPRET_BLOCK'
        from InterpretedBlock.java:374:in `evalBlockBody'
        from InterpretedBlock.java:295:in `yield'
        from InterpretedBlock.java:229:in `yieldSpecific'
        from Block.java:99:in `yieldSpecific'
        from ZYieldNode.java:25:in `interpret'
        from LocalAsgnNode.java:123:in `interpret'
        from NewlineNode.java:104:in `interpret'
        from BlockNode.java:71:in `interpret'
        from ASTInterpreter.java:75:in `INTERPRET_METHOD'
        from InterpretedMethod.java:212:in `call'
        from DefaultMethod.java:207:in `call'
        from CachingCallSite.java:322:in `cacheAndCall'
        from CachingCallSite.java:178:in `callBlock'
        from CachingCallSite.java:187:in `callIter'
        from FCallOneArgBlockNode.java:34:in `interpret'
        from NewlineNode.java:104:in `interpret'
        from ASTInterpreter.java:112:in `INTERPRET_BLOCK'
        from InterpretedBlock.java:374:in `evalBlockBody'
        from InterpretedBlock.java:295:in `yield'
        from InterpretedBlock.java:229:in `yieldSpecific'
        from Block.java:99:in `yieldSpecific'
        from ZYieldNode.java:25:in `interpret'
        from NewlineNode.java:104:in `interpret'
        from RescueNode.java:216:in `executeBody'
        from RescueNode.java:120:in `interpretWithJavaExceptions'
        from RescueNode.java:110:in `interpret'
        from ASTInterpreter.java:75:in `INTERPRET_METHOD'
        from InterpretedMethod.java:212:in `call'
        from DefaultMethod.java:207:in `call'
        from CachingCallSite.java:322:in `cacheAndCall'
        from CachingCallSite.java:178:in `callBlock'
        from CachingCallSite.java:187:in `callIter'
        from FCallOneArgBlockNode.java:34:in `interpret'
        from NewlineNode.java:104:in `interpret'
        from BlockNode.java:71:in `interpret'
        from ASTInterpreter.java:75:in `INTERPRET_METHOD'
        from InterpretedMethod.java:147:in `call'
        from DefaultMethod.java:183:in `call'
        from CachingCallSite.java:292:in `cacheAndCall'
        from CachingCallSite.java:135:in `call'
        from sbin/puppetmasterd:4:in `__file__'
        from sbin/puppetmasterd:-1:in `load'
        from Ruby.java:732:in `runScript'
        from Ruby.java:725:in `runScript'
        from Ruby.java:632:in `runNormally'
        from Ruby.java:481:in `runFromMain'
        from Main.java:343:in `doRunFromMain'
        from Main.java:255:in `internalRun'
        from Main.java:221:in `run'
        from Main.java:205:in `run'
        from Main.java:185:in `main'
{code}

This can be triggered by the attached unit test.
The tests fails under jruby-ossl 0.7.4 but works fine under MRI 1.8.7.

This happens when parsing the X509 Attributes which are not formatted as the 
JRuby OSSL Request needs.

Apparently Jruby-ossl needs attributes formatted as: 
SET
  SET
    SEQUENCE

But MRI generated attributes are of the format:
SET
  SEQUENCE
     SEQUENCE

I've included a trivial patch that fixes the problem.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.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