> Well that error is pretty self explanatory.   But that line is not
> achieving anything anyway as you are immediately overwriting cert with
> something else.
>
> Colin



The complete code is now:

ks = KeyStore.getInstance("JKS")
charsPass = "changeit".to_java_string.toCharArray
ks.load(FileInputStream.new("keys/truststore.jks"), charsPass)
keyEntry = ks.getEntry("mykey",
KeyStore::PasswordProtection.new(charsPass))
cert = keyEntry.getCertificate

#Create the KeyInfo containing the X509Data.
kif = sigFactory.getKeyInfoFactory
x509Content = ArrayList.new
x509Content.add(cert.getSubjectX500Principal.getName)
x509Content.add(cert)
xd = kif.newX509Data(x509Content)
ki = kif.newKeyInfo(Collections.singletonList(xd))

But i am getting "NoMethodError: undefined method `getCertificate' for
nil:NilClass" error
 for this line: cert = keyEntry.getCertificate

Am i missing something?
do you know for which reason my getEntry call failed ? because i am
doing exactly the same...

Thanks

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to