jruby-openssl icon indicating copy to clipboard operation
jruby-openssl copied to clipboard

Java::JavaLang::ClassCastException (org.jruby.RubyString cannot be cast to org.jruby.ext.openssl.ASN1$ASN1Data)

Open HoneyryderChuck opened this issue 3 years ago • 0 comments

Hi 👋 ,

I'm getting the following error when transforming a given ASN1Data structure to der:

asn = OpenSSL::ASN1::ASN1Data.new("bla", 0, :APPLICATION).
asn.to_der

#       16: from org.jruby.ir.instructions.CallBase.interpret(CallBase.java:549)
#       15: from org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:85)
#       14: from org.jruby.RubyKernel$INVOKER$s$0$3$eval.call(RubyKernel$INVOKER$s$0$3$eval.gen)
#       13: from org.jruby.RubyKernel.eval(RubyKernel.java:1091)
#       12: from org.jruby.RubyKernel.evalCommon(RubyKernel.java:1129)
#       11: from org.jruby.ir.interpreter.Interpreter.evalWithBinding(Interpreter.java:182)
#       10: from org.jruby.ir.interpreter.Interpreter.evalCommon(Interpreter.java:157)
#        9: from org.jruby.ir.interpreter.Interpreter.INTERPRET_EVAL(Interpreter.java:106)
#        8: from org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:72)
#        7: from org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:345)
#        6: from org.jruby.runtime.callsite.RefinedCachingCallSite.call(RefinedCachingCallSite.java:59)
#        5: from org.jruby.ext.openssl.ASN1$ASN1Data$INVOKER$i$0$0$to_der.call(ASN1$ASN1Data$INVOKER$i$0$0$to_der.gen)
#        4: from org.jruby.ext.openssl.ASN1$ASN1Data.to_der(ASN1.java:1412)
#        3: from org.jruby.ext.openssl.ASN1$ASN1Data.toDER(ASN1.java:1422)
#        2: from org.jruby.ext.openssl.ASN1$ASN1Data.toASN1(ASN1.java:1381)
#        1: from org.jruby.ext.openssl.ASN1$ASN1Data.toASN1TaggedObject(ASN1.java:1406)
# Java::JavaLang::ClassCastException (org.jruby.RubyString cannot be cast to org.jruby.ext.openssl.ASN1$ASN1Data)

I guess something is missing here, where the RubyString, or Ruby primitive for that matter, must be first cast into the respective java object, before being passed down to .toASN1.

HoneyryderChuck avatar Aug 20 '22 13:08 HoneyryderChuck