0

Possible Duplicate:
How do I accept a self-signed certificate with a Java HttpsURLConnection?

I need to connect to a website an send an xml in the request. The web site is using a HTTPS connection. The site does not provide the automatic download of the certificate. So, they have provided a certificate in the PEM format. Can anyone give an example of connecting throuhg java to secure site using a certificate? Or where do I need to install this certificate in order to use it in the java program?

Community
  • 1
  • 1
Afaque
  • 129
  • 3
  • 15
  • 1
    "The site does not provide the automatic download of the certificate" - this doesn't make much sense. When you connect to the server using HTTPS, the certificate is presented by the server during TLS handshake. If they have a certificate issued by one of respected CAs, your client-side code should be able to validate it. And if they welcome you to download and trust their certificate in PEM format, this makes security void as the attacker can replace the PEM offered for download, and then sniff communications. – Eugene Mayevski 'Callback Sep 12 '12 at 16:24
  • Post the some code you tried also any exception trace if you are facing any exception. – basiljames Sep 13 '12 at 06:48
  • The thing is I have the certificate. If i try to connect to the web site it says permission denied. I want to use the certificate they provided via email to connect to the site. – Afaque Sep 13 '12 at 09:00
  • by the way i found the answer over here: http://stackoverflow.com/questions/723368/how-to-use-pem-file-to-create-a-ssl-socket-in-java – Afaque Sep 13 '12 at 09:00

0 Answers0