aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Unable to get security certificates from HTTPS Server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Reply locked New topic
Author

Unable to get security certificates from HTTPS Server

tarandeep sawhney
Greenhorn

Joined: Mar 13, 2007
Posts: 2
Hi
Below is the requirement for which i need to get hold of security certificate.

The Requirement:
Prior to processing standard Net Connect HTTPS transactions, the Net Connect client must check the certificate on the HTTPS server.

The client must check the following four conditions in order to validate if certificate is valid:
1) The URL in the certificate must match the URL retrieved from ECALS
2) The certificate must be from a valid certificate authority
3) The certificate must not be expired

When i open http connection to HTTPS URL and debug, HttpURLConnection object, i could notice security certificates in the object.
I need help in how to get these certificates from HttpConnection InputStream.

I've tried doing:

is = httpcon.getInputStream();
CertificateFactory cf = CertificateFactory.getInstance("X509");
X509Certificate c = (X509Certificate) cf.generateCertificate(is);

but it throws exception "Invalid DER Encoded format".

Not sure how to get hold of certificates at HTTPS server.

Look fwd to timely help

regards
tarandeep
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41532
    
  53
Welcome to JavaRanch.

Please do not post the same question to multiple forums: CarefullyChooseOneForum

Let's continue the discussion in this duplicate thread.


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unable to get security certificates from HTTPS Server