title: Using .p12 file for SSL - Using Spring Boot
body: <p>I want to connect to a secure server endpoint. The service provider has provided me with a .p12 file and the password. I tried the API call on postman after adding the certificate under <strong>settings --> certificates--> client certificates</strong> and it was a success.</p>
  
  <p>Now I want to integrate this to my java code. I am developing this application using Spring boot and I followed a couple of guides for this.I added the the .p12 file to my keystore using this command.</p>
  
  <pre><code>keytool -importkeystore -srckeystore uat_client.p12 -destkeystore store.keys -srcstoretype pkcs12 -alias myownkeyname 
  </code></pre>
  
  <p>But every time I get "No SSL Client Certificate Provided"which is the same response I got when I did not add the certificate in the postman.</p>
  
  <p>I know this is not the ideal way to ask help since I do not have much code to show.And I am very new to this area of java. I am merely asking for some guide. If I have a .p12 file what are the steps I need to follow to connect to the service successfull.</p>
  
  <pre><code>public void someMethod()
  {
      RestTemplate restTemplate = new RestTemplate();
      HttpHeaders httpHeaders = new HttpHeaders();
  
      String uri = "https://xx.net/api/v2/somemethod";
  
      httpHeaders.setContentType(MediaType.APPLICATION_JSON);
  
      String result = restTemplate.getForObject(uri, String.class);
  
      System.out.println("Result " + result);
  }
  </code></pre>