title: DER input, Integer tag error when connecting WSDL in Java
body: <p>I generated a certificate using keytool from a .pfx file and included in the system property as mentioned below.</p>
  
  <pre><code>System.setProperty("javax.net.ssl.keyStore", "C:\\cert.crt");
  System.setProperty("javax.net.ssl.KeyPassword", "password");
  System.setProperty("javax.net.ssl.keyStoreType", "pkcs12");
  System.setProperty("javax.net.debug", "SSL");
  </code></pre>
  
  <p>As I have included the "debug" property, I get the below message in Console when I execute the required method.</p>
  
  <pre><code>keyStore is : C:\cert.crt
  keyStore type is : pkcs12
  keyStore provider is : 
  init keystore
  default context init failed: java.io.IOException: DER input, Integer tag error
  </code></pre>
  
  <p>The exception details are provided below. What are the things that I am doing wrong here?</p>
  
  <pre><code>java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl).
      at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.tryWithMex(RuntimeWSDLParser.java:151)
      at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:133)
      at com.sun.xml.internal.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:234)
      at com.sun.xml.internal.ws.client.WSServiceDelegate.&lt;init&gt;(WSServiceDelegate.java:197)
      at com.sun.xml.internal.ws.client.WSServiceDelegate.&lt;init&gt;(WSServiceDelegate.java:145)
      at com.sun.xml.internal.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:93)
      at javax.xml.ws.Service.&lt;init&gt;(Service.java:56)
  Caused by: java.net.SocketException: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl)
      at javax.net.ssl.DefaultSSLSocketFactory.throwException(SSLSocketFactory.java:179)
      at javax.net.ssl.DefaultSSLSocketFactory.createSocket(SSLSocketFactory.java:186)
      at sun.net.www.protocol.https.HttpsClient.createSocket(HttpsClient.java:362)
      at sun.net.NetworkClient.doConnect(NetworkClient.java:145)
      at sun.net.www.http.HttpClient.openServer(HttpClient.java:411)
      at sun.net.www.http.HttpClient.openServer(HttpClient.java:525)
      at sun.net.www.protocol.https.HttpsClient.&lt;init&gt;(HttpsClient.java:272)
      at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:329)
      at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:172)
      at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:923)
      at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:158)
      at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1195)
      at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:234)
      at java.net.URL.openStream(URL.java:1010)
      at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.createReader(RuntimeWSDLParser.java:793)
      at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.resolveWSDL(RuntimeWSDLParser.java:251)
      at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:118)
      ... 10 more
  Caused by: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl)
      at java.security.Provider$Service.newInstance(Provider.java:1245)
      at sun.security.jca.GetInstance.getInstance(GetInstance.java:220)
      at sun.security.jca.GetInstance.getInstance(GetInstance.java:147)
      at javax.net.ssl.SSLContext.getInstance(SSLContext.java:125)
      at javax.net.ssl.SSLContext.getDefault(SSLContext.java:68)
      at javax.net.ssl.SSLSocketFactory.getDefault(SSLSocketFactory.java:102)
      at javax.net.ssl.HttpsURLConnection.getDefaultSSLSocketFactory(HttpsURLConnection.java:327)
      at javax.net.ssl.HttpsURLConnection.&lt;init&gt;(HttpsURLConnection.java:285)
      at sun.net.www.protocol.https.HttpsURLConnectionImpl.&lt;init&gt;(HttpsURLConnectionImpl.java:65)
      at sun.net.www.protocol.https.Handler.openConnection(Handler.java:42)
      at sun.net.www.protocol.https.Handler.openConnection(Handler.java:37)
      at java.net.URL.openConnection(URL.java:945)
      ... 14 more
  Caused by: java.io.IOException: DER input, Integer tag error
      at sun.security.util.DerInputStream.getInteger(DerInputStream.java:151)
      at com.sun.net.ssl.internal.pkcs12.PKCS12KeyStore.engineLoad(PKCS12KeyStore.java:1202)
      at java.security.KeyStore.load(KeyStore.java:1185)
      at com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl.getDefaultKeyManager(DefaultSSLContextImpl.java:150)
      at com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl.&lt;init&gt;(DefaultSSLContextImpl.java:40)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
      at java.lang.Class.newInstance0(Class.java:357)
      at java.lang.Class.newInstance(Class.java:310)
      at java.security.Provider$Service.newInstance(Provider.java:1221)
      ... 25 more
  </code></pre>