Advertisement
Guest User

Untitled

a guest
Oct 21st, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. System.setProperty("javax.net.debug", "all");
  2.  
  3. adding as trusted cert:
  4. Subject: CN=Entrust.net Certification Authority (2048), OU=(c) 1999 Entrust.net Limited, OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.), O=Entrust.net
  5. Issuer: CN=Entrust.net Certification Authority (2048), OU=(c) 1999 Entrust.net Limited, OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.), O=Entrust.net
  6. Algorithm: RSA; Serial number: 0x3863def8
  7. Valid from Fri Dec 24 12:50:51 EST 1999 until Tue Jul 24 10:15:12 EDT 2029
  8.  
  9. main, READ: TLSv1 Handshake, length = 2649
  10. *** Certificate chain
  11. chain [0] = [0] Version: 3
  12. SerialNumber: 1356119177
  13. IssuerDN: C=US,O=Entrust, Inc.,OU=See www.entrust.net/legal-terms,OU=(c) 2012 Entrust, Inc. - for authorized use only,CN=Entrust Certification Authority - L1K
  14. Start Date: Wed Jul 15 11:50:20 EDT 2015
  15. Final Date: Sun Jul 15 18:27:04 EDT 2018
  16.  
  17. ***
  18. Caught: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException:
  19. PKIX path building failed: java.security.cert.CertPathBuilderException:
  20. No issuer certificate for certificate in certification path found.
  21. main, SEND TLSv1 ALERT: fatal, description = certificate_unknown
  22.  
  23. private class TrustAll implements X509TrustManager
  24. {
  25. public void checkClientTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException
  26. {
  27. }
  28.  
  29. public void checkServerTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException
  30. {
  31. }
  32.  
  33. public X509Certificate[] getAcceptedIssuers()
  34. {
  35. return new X509Certificate[0];
  36. }
  37.  
  38. TrustManager[] trustArray = [new TrustAll()] as TrustManager[]
  39. SSLContext ctx = SSLContext.getInstance("TLSv1");
  40. ctx.init(null, trustArray, null);
  41.  
  42. // create an http client builder
  43. HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
  44. httpClientBuilder.setSslcontext(ctx)
  45.  
  46. httpclient = httpClientBuilder.build();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement