This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Certificate Trust

 
Patrick McDonogh
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ya all,

I am trying to check if a particular certificate is trusted in a keystore.
I have created a keystore called trust.truststore and in there i have the root and issuing CA certificates as trusted entries. I have loaded this keystore as a java.security.KeyStore.

I then have an X509Certificate object which has the public key of a certificate issued by the issuing CA. This X509Certificate is the certificate that i want to check is trusted using the trusted entries in the KeyStore object.

Does anyone know how to check this or could start me off in the right direction ???

Thankyou everyone.
 
Lanny Gilbert
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's some code that works for the "builtin" Java keystore. I'm sure it can be tweaked to match your keystore.

http://javaalmanac.com/egs/java.security.cert/ListTrustAnchors.html
 
Patrick McDonogh
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thankyou very much.
That helpd me a lot.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic