I wan to download the certificates from URL using Java code, No for say ignore certificate or do manual steps to download from browser and add keystor

39 views Asked by At

enter image description here

During the development of a Java webservice client I ran into a problem. Authentication for the webservice is using a client certificate, a username and a password. The client certificate I received from the company behind the webservice is in .cer format.

I know we can do the above steps as shown in pic, but my question is tools like postman or soapUi automatically takes care of this steps. so, I want to implement the same in my java code.

Can some give me code to download .cer file using java code

1

There are 1 answers

0
Hakan54 On

I have built in the past an utility class which can do this. The usage is basically:

List<X509Certificate> certificates = CertificateUtils.getCertificatesFromExternalSource("https://github.com/");

The library is available here: GitHub: SSLContext-kickstart You can add it to your maven project with:

<dependency>
    <groupId>io.github.hakky54</groupId>
    <artifactId>sslcontext-kickstart</artifactId>
    <version>8.3.2</version>
</dependency>