Thanks that sorted it! Would have taken me ages to find. Thanks very much! 

Carl Bourne | Senior Sales Engineer | mobile: +44 (0) 7770 284294 | 
www.venafi.com

On 9 Jan 2013, at 19:20, Rodrigo Rosenfeld Rosas <rr.ro...@gmail.com> wrote:

> 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...

Reply via email to