java procedure to accessing https service using jks file -


  1. java code call remote web service jks file.
  2. how access authorized service using certificate. , added please define java keystore. new these processes. getting following error while trying related this

    cause javax.net.ssl.sslhandshakeexception: sun.security.validator.validatorexception:  pkix path building failed: sun.security.provider.certpath.suncertpathbuilderexception 

i struggling last 1 month. please needful. forgive me grammatical mistake.

first need obtain public certificate server you're trying connect to. can done in variety of ways, such contacting server admin , asking it, using openssl download it, or, if http server, connecting browser, viewing page's security info, , saving copy of certificate. (google should able tell specific browser.)

now have certificate saved in file, need add jvm's trust store. @ $java_home/jre/lib/security/ jdks or $java_home/lib/security jres, there's file named cacerts, comes java , contains public certificates of well-known certifying authorities. import new cert, run keytool user has permission write cacerts:

keytool -import -file <the cert file> -alias <some meaningful name> -keystore <path cacerts file> 

it ask password. default password shipped java "changeit". nobody changes it. after complete these relatively simple steps, you'll communicating securely , assurance you're talking right server , right server (as long don't lose private key).


Comments