I’m trying to call a javax.crypto.Cipher.init method[1] in JRuby.
Here’s a jirb excerpt:
cipher.init(javax.crypto.Cipher::WRAP_MODE, key_spec)
NameError: no init with arguments matching [class java.lang.Long,
class java.security.spec.RSAPublicKeySpec] on object JavaUtilities
irb(main):152:0> cipher.init(3, key_spec)
NameError: no init with arguments matching [class java.lang.Long,
class java.security.spec.RSAPublicKeySpec] on object JavaUtilities
I’ve made a variety of other attempts to coerce the long into an int,
but it seems as if they always get converted into a Ruby Fixnum before
the init method is run. Is there any way to coerce that 3 into a java
int when the init method is run?
Also the jruby version is “ruby 1.8.6 (2008-05-28 rev 6586)
[x86-jruby1.1.2]”.
Thanks,
Jeff
P.S. JRuby is awesome! Thanks to all the developers on this project!
irb(main):152:0> cipher.init(3, key_spec)
NameError: no init with arguments matching [class java.lang.Long,
class java.security.spec.RSAPublicKeySpec] on object JavaUtilities
I’ve made a variety of other attempts to coerce the long into an int,
but it seems as if they always get converted into a Ruby Fixnum before
the init method is run. Is there any way to coerce that 3 into a java
int when the init method is run?
Also the jruby version is “ruby 1.8.6 (2008-05-28 rev 6586) [x86-jruby1.1.2]”.
It seems a little verbose and painful, but what about
cipher.init(java.lang.Long.new(3), key_spec)
Could you file a bug too in JIRA? I think we should track this as a
java integration use case to be improved upon. http://jira.codehaus.org/browse/JRUBY