Em 09-01-2013 17:13, Rodrigo Rosenfeld Rosas escreveu:
Em 09-01-2013 16:53, Carl Bourne escreveu:
Hi I'm trying to create a Java Store Key Store using the following code:

    entityStore2 = KeyStore.getInstance("JKS")
    entityStore2.load(nil, nil)
    puts entityStore2.methods
    entityStore2.setKeyEntry("Test", privatekey.getPrivate,
    String.new("password").to_java.toCharArray, t.getChain)

However, I keep hitting the same NameError whenever I call the setKeyEntry method:

NameError: no method 'setKeyEntry' for arguments (org.jruby.RubyString,org.bouncycastle.jcajce.provider.asymmetric.rsa.BCRSAPrivateCrtKey,org.jruby.java.proxies.ArrayJavaProxy,org.jruby.RubyArray) on Java::JavaSecurity::KeyStore


entityStore2.setKeyEntry("Test", privatekey.getPrivate, "password".to_java.toCharArray, t.getChain.to_java(java.security.cert.Certificate))

hint: I'm not sure what privatekey is, but maybe privatekey.private will work the same as privatekey.getPrivate on the line above.

By the way, if you haven't checked this yet, please do:

https://github.com/jruby/jruby/wiki/CallingJavaFromJRuby

I was just reading it and they suggest that you use t.getChain.to_java(Java::SecurityCert::Certificate) in my previous example. Actually t.chain.to_java could just work, I'm not sure...<http://kenai.com/projects/jruby/pages/CallingJavaFromJRuby><http://kenai.com/projects/jruby/pages/CallingJavaFromJRuby#Converting_a_Ruby_Array_to_a_Java_Array>

Reply via email to