title: javax.net.ssl.SSLException: java.lang.RuntimeException: Could not generate DH keypair
body: <p>I am getting below error while hitting HTTPS URL with Java code develoed in JDK1.6</p>
  
  <pre><code>    javax.net.ssl.SSLException: java.lang.RuntimeException: Could not generate DH keypair
          at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:190)
          at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1649)
          at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1612)
          at com.sun.net.ssl.internal.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1595)
          at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1172)
          at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1149)
          at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:434)
      at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:166)
      at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1019)
      at 
  sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:230)
          at testHTTP.main(testHTTP.java:70)
  Caused by: java.lang.RuntimeException: Could not generate DH keypair
          at com.sun.net.ssl.internal.ssl.DHCrypt.&lt;init&gt;(DHCrypt.java:106)
          at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverKeyExchange(ClientHandshaker.java:556)
          at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:183)
          at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:593)
          at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:529)
          at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:893)
          at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1138)
          at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1165)
          ... 6 more
  Caused by: java.security.InvalidAlgorithmParameterException: Prime size must be multiple of 64, and can only range from 512 to 1024 (inclusive)
          at com.sun.crypto.provider.DHKeyPairGenerator.initialize(DashoA13*..)
          at java.security.KeyPairGenerator$Delegate.initialize(KeyPairGenerator.java:627)
          at com.sun.net.ssl.internal.ssl.DHCrypt.&lt;init&gt;(DHCrypt.java:100)
          ... 13 more
  </code></pre>
  
  <p><br/><br/>
  What should be done in this case if I want to use JDK1.6 only..
  <br/><br/>
  Please suggest</p>