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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 7 of 7 | next ›
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedDec 6, '11 at 3:12p
activeDec 7, '11 at 1:44p
posts7
users2
websiterubyonrails.org
irc#RubyOnRails

2 users in discussion

Gs84: 4 posts Colin Law: 3 posts

People

Translate

site design / logo © 2021 Grokbase