{"id":319225,"date":"2021-02-05T02:59:17","date_gmt":"2021-02-04T18:59:17","guid":{"rendered":"http:\/\/4563.org\/?p=319225"},"modified":"2021-02-05T02:59:17","modified_gmt":"2021-02-04T18:59:17","slug":"java-%e8%b0%83%e7%94%a8-https-%e6%8e%a5%e5%8f%a3%e6%8a%a5%e9%94%99javax-net-ssl-sslexception-server-key%e8%bf%99%e4%b8%aa%e6%8a%a5%e9%94%99%e5%8e%9f%e7%90%86%e6%9c%89%e5%a4%a7%e7%a5%9e%e8%83%bd","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=319225","title":{"rendered":"Java \u8c03\u7528 https \u63a5\u53e3\u62a5\u9519:javax.net.ssl.SSLException: Server key,\u8fd9\u4e2a\u62a5\u9519\u539f\u7406\u6709\u5927\u795e\u80fd\u79d1\u666e\u4e00\u4e0b\u5417\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  Java \u8c03\u7528 https \u63a5\u53e3\u62a5\u9519:javax.net.ssl.SSLException: Server key,\u8fd9\u4e2a\u62a5\u9519\u539f\u7406\u6709\u5927\u795e\u80fd\u79d1\u666e\u4e00\u4e0b\u5417\uff1f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : burnbrid <\/span>  <span><i><\/i> 4<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>JDK \u7248\u672c\u4fe1\u606f:<\/p>\n<pre><code>java version \"1.6.0_113\" Java(TM) SE Runtime Environment (build 1.6.0_113-b01) Java HotSpot(TM) 64-Bit Server VM (build 20.111-b01, mixed mode) <\/code><\/pre>\n<p>Linux \u7248\u672c\u4fe1\u606f:<\/p>\n<pre><code>Linux testUser 2.6.32-431.el6.x86_64 #1 SMP Sun Nov 10 22:19:54 EST 2013 x86_64 x86_64 x86_64 GNU\/Linux Linux version 2.6.32-431.el6.x86_64 ([email&#160;protected]) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC) ) #1 SMP Sun Nov 10 22:19:54 EST 2013 <\/code><\/pre>\n<p>Weblogic \u7248\u672c<\/p>\n<pre><code>WebLogic Server 10.3.6.0 weblogic11g\uff0c\u4e5f\u5c31\u662f 10.3.6 \u7248\u672c <\/code><\/pre>\n<p>JAVA \u4ee3\u7801\u4e2d\u901a\u8fc7 org.apache.http.client.methods.HttpPost(\u6765\u81ea JAR \u5305 httpclient-4.5.9.jar)\u8c03\u7528\u4e00\u4e2a https \u7684\u63a5\u53e3(\u7b2c\u4e09\u65b9\u5e73\u53f0\u63d0\u4f9b\u7684\u63a5\u53e3,\u63a5\u53e3\u5730\u5740\u516c\u53f8\u4fdd\u5bc6,\u4e0d\u80fd\u63d0\u4f9b\u51fa\u6765,\u7c7b\u4f3c https:\/\/testfile.comyan.org.cn\/system\/sc\/qeuestUpload),\u62a5\u9519\u3002\u62a5\u9519\u8be6\u7ec6\u4fe1\u606f\u5982\u4e0b: \u65b9\u6cd5\u5165\u53e3\u662f sendHttpsAndSkipCertificate \u8fd9\u4e2a\u65b9\u6cd5<\/p>\n<pre><code>javax.net.ssl.SSLException: Server key  at com.sun.net.ssl.internal.ssl.Handshaker.throwSSLException(Handshaker.java:1139)  at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:248)  at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:817)  at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:753)  at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:989)  at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1295)  at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1322)  at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1306)  at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:436)  at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:384)  at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142)  at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:374)  at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:393)  at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)  at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)  at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)  at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)  at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)  at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)  at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108)  at com.company.kb.common.utils.HttpUrlTool.sendHttpsAndSkipCertificate(HttpUrlTool.java:1528)  at com.company.kb.policy.app.newest.platform.car.service.shenzhen.platservice.uploadPolicyInfo(VhlPlatformHandlerShenzhenNewestImpl.java:19083)  at com.company.kb.policy.prod.vhl.bm.PolicyAppVhlBM.sendUrServiceBm(PolicyAppVhlBM.java:1002)  at com.company.kb.policy.prod.vhl.bm.PolicyAppVhlBM.sendUrService(PolicyAppVhlBM.java:907)  at com.company.kb.policy.app.quickapp.action.QuickAppBaseBizAction.sendUr(QuickAppBaseBizAction.java:2634)  at sun.reflect.GeneratedMethodAccessor7523.invoke(Unknown Source)  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)  at java.lang.reflect.Method.invoke(Method.java:597)  at org.apache.commons.beanutils.MethodUtils.invokeExactMethod(MethodUtils.java:404)  at org.apache.commons.beanutils.MethodUtils.invokeExactMethod(MethodUtils.java:354)  at com.isoftstone.fwk.facade.BizControllerImpl.handleRequest(BizControllerImpl.java:126)  at com.isoftstone.fwk.facade.BizControllerPojoAdapter.handleRequest(BizControllerPojoAdapter.java:37)  at com.isoftstone.fwk.action.BaseWebAction.perform(BaseWebAction.java:67)  at sun.reflect.GeneratedMethodAccessor239.invoke(Unknown Source)  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)  at java.lang.reflect.Method.invoke(Method.java:597)  at org.apache.commons.beanutils.MethodUtils.invokeExactMethod(MethodUtils.java:404)  at org.apache.commons.beanutils.MethodUtils.invokeExactMethod(MethodUtils.java:354)  at com.isoftstone.fwk.action.ActionControl.excute(ActionControl.java:19)  at com.isoftstone.fwk.web.WebControl.doAction(WebControl.java:225)  at com.isoftstone.fwk.web.WebControl.doPost(WebControl.java:47)  at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)  at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)  at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)  at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)  at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301)  at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)  at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)  at com.isoftstone.fwk.web.filter.DWCallbackFilter.doFilter(DWCallbackFilter.java:110)  at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)  at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:359)  at org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)  at org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)  at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)  at org.springframework.security.ui.SessionFixationProtectionFilter.doFilterHttp(SessionFixationProtectionFilter.java:67)  at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)  at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)  at org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:101)  at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)  at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)  at org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter.doFilterHttp(SecurityContextHolderAwareRequestFilter.java:91)  at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)  at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)  at org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:116)  at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)  at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)  at org.springframework.security.ui.logout.LogoutFilter.doFilterHttp(LogoutFilter.java:59)  at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)  at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)  at org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:238)  at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)  at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)  at org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:174)  at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)  at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)  at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)  at org.jasig.cas.client.session.SingleSignOutFilter.doFilter(SingleSignOutFilter.java:99)  at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)  at com.isoftstone.iaeap.web.filter.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:97)  at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)  at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3748)  at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3714)  at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)  at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)  at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2283)  at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2182)  at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1499)  at weblogic.work.ExecuteThread.execute(ExecuteThread.java:263)  at weblogic.work.ExecuteThread.run(ExecuteThread.java:221) Caused by: java.security.spec.InvalidKeySpecException: key spec not recognised  at cfca.sadk.org.bouncycastle.jcajce.provider.asymmetric.util.BaseKeyFactorySpi.engineGeneratePublic(BaseKeyFactorySpi.java:36)  at cfca.sadk.org.bouncycastle.jcajce.provider.asymmetric.ec.KeyFactorySpi.engineGeneratePublic(KeyFactorySpi.java:89)  at java.security.KeyFactory.generatePublic(KeyFactory.java:304)  at com.sun.net.ssl.internal.ssl.HandshakeMessage$ECDH_ServerKeyExchange.&lt;init&gt;(HandshakeMessage.java:920)  at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:244)  ... 87 more javax.net.ssl.SSLException: Server key  at com.sun.net.ssl.internal.ssl.Handshaker.throwSSLException(Handshaker.java:1139)  at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:248)  at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:817)  at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:753)  at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:989)  at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1295)  at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1322)  at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1306)  at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:436)  at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:384)  at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142)  at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:374)  at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:393)  at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)  at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)  at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)  at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)  at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)  at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)  at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108)  at com.company.kb.common.utils.HttpUrlTool.sendHttpsAndSkipCertificate(HttpUrlTool.java:1528)  at com.company.kb.policy.app.newest.platform.car.service.shenzhen.VhlPlatformHandlerShenzhenNewestImpl.uploadPolicyInfo(VhlPlatformHandlerShenzhenNewestImpl.java:19083)  at com.company.kb.policy.prod.vhl.bm.PolicyAppVhlBM.undrDicision(PolicyAppVhlBM.java:1002)  at com.company.kb.policy.prod.vhl.bm.PolicyAppVhlBM.quickSubmitToUnderwriting(PolicyAppVhlBM.java:907)  at com.company.kb.policy.app.quickapp.action.QuickAppBaseBizAction.quickSubmitToUnderwriting(QuickAppBaseBizAction.java:2634)  at sun.reflect.GeneratedMethodAccessor7523.invoke(Unknown Source)  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)  at java.lang.reflect.Method.invoke(Method.java:597)  at org.apache.commons.beanutils.MethodUtils.invokeExactMethod(MethodUtils.java:404)  at org.apache.commons.beanutils.MethodUtils.invokeExactMethod(MethodUtils.java:354)  at com.isoftstone.fwk.facade.BizControllerImpl.handleRequest(BizControllerImpl.java:126)  at com.isoftstone.fwk.facade.BizControllerPojoAdapter.handleRequest(BizControllerPojoAdapter.java:37)  at com.isoftstone.fwk.action.BaseWebAction.perform(BaseWebAction.java:67)  at sun.reflect.GeneratedMethodAccessor239.invoke(Unknown Source)  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)  at java.lang.reflect.Method.invoke(Method.java:597)  at org.apache.commons.beanutils.MethodUtils.invokeExactMethod(MethodUtils.java:404)  at org.apache.commons.beanutils.MethodUtils.invokeExactMethod(MethodUtils.java:354)  at com.isoftstone.fwk.action.ActionControl.excute(ActionControl.java:19)  at com.isoftstone.fwk.web.WebControl.doAction(WebControl.java:225)  at com.isoftstone.fwk.web.WebControl.doPost(WebControl.java:47)  at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)  at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)  at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)  at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)  at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301)  at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)  at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)  at com.isoftstone.fwk.web.filter.DWCallbackFilter.doFilter(DWCallbackFilter.java:110)  at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)  at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:359)  at org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)  at org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)  at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)  at org.springframework.security.ui.SessionFixationProtectionFilter.doFilterHttp(SessionFixationProtectionFilter.java:67)  at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)  at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)  at org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:101)  at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)  at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)  at org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter.doFilterHttp(SecurityContextHolderAwareRequestFilter.java:91)  at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)  at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)   <\/code><\/pre>\n<p>\u9879\u76ee\u4e2d\u8c03\u7528 http \u63a5\u53e3\u7684\u65b9\u6cd5\u4ee3\u7801\u5982\u4e0b:<\/p>\n<pre><code> private static CloseableHttpClient buildSSLCloseableHttpClient() throws Exception {         SSLContext sslContext = new SSLContextBuilder().loadTrustMaterial(null, new TrustStrategy() {             \/\/ \u4fe1\u4efb\u6240\u6709             public boolean isTrusted(X509Certificate[] chain, String authType) throws CertificateException {                 return true;             }         }).build();         \/\/ ALLOW_ALL_HOSTNAME_VERIFIER:\u8fd9\u4e2a\u4e3b\u673a\u540d\u9a8c\u8bc1\u5668\u57fa\u672c\u4e0a\u662f\u5173\u95ed\u4e3b\u673a\u540d\u9a8c\u8bc1\u7684,\u5b9e\u73b0\u7684\u662f\u4e00\u4e2a\u7a7a\u64cd\u4f5c\uff0c\u5e76\u4e14\u4e0d\u4f1a\u629b\u51fa javax.net.ssl.SSLException \u5f02\u5e38\u3002         SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslContext, new String[] { \"TLSv1\" }, null,                 SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);         return HttpClients.custom().setSSLSocketFactory(sslsf).build();     }   public static String sendHttpsAndSkipCertificate(Map&lt;String,String&gt; httpMap, String jsonStr) throws BusinessServiceException {      long startTime = 0L;      long endTime = 0L;         String result = null;\/\/ \u8fd4\u56de\u7684\u7ed3\u679c         CloseableHttpResponse response = null;         CloseableHttpClient client = null;         HttpPost httpPost = new HttpPost( httpMap.get(\"url\")); \/\/\u521b\u5efa HttpPost \u5bf9\u8c61           \/\/ \u53c2\u6570\u4e0d\u4e3a\u7a7a         if(StringUtils.isNotBlank(jsonStr)) {             try {          \/\/\u5305\u88c5\u6210\u4e00\u4e2a Entity \u5bf9\u8c61              StringEntity entity = new StringEntity(jsonStr, CommCodeConstants.ENCODING_UTF_8);              \/\/\u8bbe\u7f6e\u8bf7\u6c42\u7684\u5185\u5bb9              httpPost.setEntity(entity);              \/\/\u8bbe\u7f6e\u8bf7\u6c42\u7684\u62a5\u6587\u5934\u90e8\u7684\u7f16\u7801              httpPost.setHeader(new BasicHeader(\"Content-Type\", \"application\/json;charset=utf-8\"));              \/\/\u8bbe\u7f6e\u671f\u671b\u670d\u52a1\u7aef\u8fd4\u56de\u7684\u7f16\u7801              httpPost.setHeader(new BasicHeader(\"Accept\", \"application\/json, text\/plain, *\/*\"));              \/\/\u8bbe\u7f6e\u8fde\u63a5\u8d85\u65f6\u65f6\u95f4 30 \u79d2              httpPost.getParams().setParameter(HttpMethodParams.SO_TIMEOUT, 30000);              \/\/\u8c03\u7528\u65b9\u6cd5\uff0c\u521b\u5efa CloseableHttpClient \u5bf9\u8c61                 client = buildSSLCloseableHttpClient();                 startTime = System.currentTimeMillis();                 response = client.execute( httpPost);                 int statusCode = response.getStatusLine().getStatusCode();                 if(HttpURLConnection.HTTP_OK == statusCode) {                     HttpEntity httpEntity = response.getEntity();                       \/\/\u53d6\u51fa\u5e94\u7b54\u5b57\u7b26\u4e32                      result = EntityUtils.toString( httpEntity);                  } else {                  throw ExceptionUtil.createBusException(\"\u6ca1\u6709\u6b63\u786e\u8fde\u63a5[\" + httpMap.get(\"name\") + \"],HTTP \u670d\u52a1\u8fd4\u56de\u6709\u8bef,\u670d\u52a1\u8fd4\u56de\u7f16\u7801\uff1a\" + statusCode);                 }             } catch (Exception e) {                 endTime = System.currentTimeMillis() - startTime;                 logger.error(\"sendHttpsAndSkipCertificateError,endTime\" + endTime, e);                 e.printStackTrace();                   result = e.getMessage().toString();                   throw ExceptionUtil.createBusException( httpMap.get(\"name\") +\"\u63a5\u53e3\u4ea4\u4e92\u51fa\u9519:\"+e.getMessage().toString());             }  finally {        if (response != null) {         try {\/\/\u5173\u95ed response \u548c client          response.close();         } catch(Exception e) {                      endTime = System.currentTimeMillis() - startTime;                      logger.error(\"sendHttpsAndSkipCertificateError,endTime\" + endTime, e);          e.printStackTrace();         }        }        if (client != null) {         try {\/\/\u5173\u95ed response \u548c client          client.close();         } catch(Exception e) {                      endTime = System.currentTimeMillis() - startTime;                      logger.error(\"sendHttpsAndSkipCertificateError,endTime\" + endTime, e);          e.printStackTrace();         }        }       }         }         return result;     } <\/code><\/pre>\n<p>\u8fd9\u4e2a\u95ee\u9898\u5bf9\u6211\u6765\u8bf4\u592a\u96be\u4e86\u3002\u6211\u4e2a\u4eba\u731c\u6d4b\u662f\u6211\u4eec\u516c\u53f8\u670d\u52a1\u5668\u4e0a\u9762\u7684\u8bc1\u4e66\u6709\u95ee\u9898,\u4f46\u662f\u6211\u4e0d\u77e5\u9053\u600e\u4e48\u770b\u670d\u52a1\u5668\u4e0a\u9762\u7684\u8bc1\u4e66\u3002\u5373\u4f7f\u6211\u770b\u5230\u4e86\u670d\u52a1\u5668\u4e0a\u9762\u7684\u8bc1\u4e66\u6211\u4e5f\u4e0d\u77e5\u9053\u600e\u4e48\u5224\u65ad\u6211\u4eec\u670d\u52a1\u5668\u4e0a\u7684\u8bc1\u4e66\u6709\u6ca1\u6709\u95ee\u9898\u3002\u6211\u4eec\u751f\u4ea7\u73af\u5883\u4e0a\u9762\u8c03\u8fd9\u4e2a\u63a5\u53e3\u4e0d\u4f1a\u62a5\u9519,\u6d4b\u8bd5\u73af\u5883\u4e0a\u5468\u6d4b\u8bd5\u7684\u65f6\u5019\u4e0d\u4f1a\u62a5\u9519\uff0c\u6628\u5929\u8ddf\u4eca\u5929\u6d4b\u8bd5\u7684\u65f6\u5019\u6bcf\u6b21\u8c03\u7528\u90fd\u62a5\u9519\u3002<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>6<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"5114425\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : sakasaka <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u91cd\u5bfc\u4e00\u4e0b BouncyCastle \u7b97\u6cd5\u5e93\u8bd5\u8bd5                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5114426\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : kingfalse <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             sslfactory \u4f60\u641c\u641c\u8fd9\u4e2a,\u53d6\u6d88 https \u7684 ssl \u9a8c\u8bc1<br \/>\u81ea\u5b9a\u4e49\u4e00\u4e2a\u8fd4\u56de null \u7684                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5114427\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : limuyan44 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4ec0\u4e48\u90fd\u6ca1\u5e72\u7a81\u7136\u62a5\u9519\u7684\u8bdd\u91cd\u65b0\u751f\u6210\u4e00\u4e0b\u8bc1\u4e66\u8bd5\u8bd5\u7422\u78e8\u4e5f\u662f\u6d6a\u8d39\u65f6\u95f4\u5f71\u54cd\u6d4b\u8bd5\u8fdb\u5ea6\u8fd8\u5f97\u80cc\u9505\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5114428\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : css3 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             vpn \u5173\u4e86\u91cd\u8bd5                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5114429\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : burnbrid <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5df2\u7ecf\u89e3\u51b3\u4e86\uff0c\u8be6\u60c5\u89c1 https:\/\/club.perfma.com\/question\/2195295\uff0c\u89e3\u51b3\u529e\u6cd5\u5c31\u662f\u5347\u7ea7\u4e86 bcprov-jdkxxx-xxx.jar \u8fd9\u4e2a jar \u5305\u3002\u7531 bcprov-jdk16-1.46.jar \u5347\u7ea7\u5230 bcprov-jdk15on-160.jar \u5c31\u89e3\u51b3\u4e86\u3002\u8fd9\u4e2a bcprov-jdkxxx-xxx.jar \u5305\u5728 JDK \u7684\u5b89\u88c5\u76ee\u5f55 jre\/lib\/ext\/\u8fd9\u4e2a\u76ee\u5f55\u4e0b\u3002\u540c\u65f6\u8fd8\u9700\u8981\u5728 JDK \u7684\u5b89\u88c5\u76ee\u5f55 \/jre\/lib\/security\/java.security \u8fd9\u4e2a\u6587\u4ef6\u4e2d\u6dfb\u52a0 security.provider.9=org.bouncycastle.jce.provider.BouncyCastleProvider<\/p>\n<p>\u56fe\u7247 https:\/\/img-ask.csdnimg.cn\/upload\/1611737103967.png                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5114430\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : burnbrid <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f46\u662f\u8fd8\u6709\u4e00\u4e2a\u7591\u95ee\u5c31\u662f\uff0c\u6211\u5728\u672c\u5730\u6d4b\u8bd5\u7684\u65f6\u5019,\u5c31\u4ece\u6765\u6ca1\u62a5\u8fc7\u8fd9\u4e2a\u9519\u3002\u6211\u672c\u5730\u7684\u73af\u5883\u662f JDK1.6.0_45,tomcat6 \u3002\u800c\u4e14\u6211\u672c\u5730\u7684 JDK \u5b89\u88c5\u76ee\u5f55 jre\/lib\/ext\/\u8fd9\u4e2a\u76ee\u5f55\u4e0b\u4e5f\u6ca1\u6709 bcprov-jdkxxx-xxx.jar \u8fd9\u79cd\u683c\u5f0f\u7684 jar \u5305\u3002\/jre\/lib\/security\/java.security \u8fd9\u4e2a\u6587\u4ef6\u91cc\u9762\u4e5f\u6ca1\u6709 security.provider.10=org.bouncycastle.jce.provider.BouncyCastleProvider \u8fd9\u6837\u7684\u914d\u7f6e\u3002\u6211\u6000\u7591\u6211\u4eec\u670d\u52a1\u5668\u4e0a\u9762\u6709\u8fd9\u4e2a bcprov-jdkxxx-xxx.jar \u5305\uff0c\u662f\u6211\u524d\u4efb\u540c\u4e8b\u4e3a\u4e86\u89e3\u51b3\u522b\u7684\u95ee\u9898\u653e\u4e0a\u53bb\u7684\u3002\u7136\u540e\u6709\u4e86\u8fd9\u4e2a bcprov-jdkxxx-xxx.jar \u5305\u4e4b\u540e\u5c31\u4f1a\u89e6\u53d1\u8bc1\u4e66\u9a8c\u8bc1\u3002\u5176\u5b9e\u6ca1\u6709\u8fd9\u4e2a bcprov-jdkxxx-xxx.jar \u5305\u76f4\u63a5\u8c03 https \u63a5\u53e3\u5e94\u8be5\u4e5f\u4e0d\u4f1a\u62a5\u9519\u3002\u6709\u4e86 bcprov-jdkxxx-xxx.jar \u5305\u521a\u597d\u89e6\u53d1\u4e86 https \u8bc1\u4e66\u9a8c\u8bc1,\u4f46\u662f\u670d\u52a1\u5668\u4e0a\u8fd9\u4e2a bcprov-jdkxxx-xxx.jar \u5305\u53c8\u4e0d\u6562\u8d38\u7136\u5220\u9664,\u5220\u4e86\u4e4b\u540e\u8981\u5927\u9762\u79ef\u6d4b\u8bd5\u7684\u3002\u5e94\u8be5\u8ddf-DUseSunHttpHandler=true \u8fd9\u4e2a JVM \u53c2\u6570\u4e5f\u6709\u5173\u7cfb\u3002\u7b49\u6211\u665a\u4e0a\u4e0b\u73ed\u6d4b\u8bd5\u4e00\u4e0b\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>Java \u8c03\u7528 https \u63a5\u53e3\u62a5&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/319225"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=319225"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/319225\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=319225"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=319225"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=319225"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}