Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7021515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:27:38+00:00 2026-05-27T23:27:38+00:00

URL myUrl = new URL(https://www…..); SSL Certificate of website is expired. How to avoid

  • 0
URL myUrl = new URL("https://www.....");

SSL Certificate of website is expired. How to avoid it and make URL() work ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T23:27:38+00:00Added an answer on May 27, 2026 at 11:27 pm

    You should build a TrustManager that wraps the default trust manager, catches the CertificiateExpiredException and ignores it.

    Note: as detailed in this answer, whether or not this is secure is very much implementation dependent. In particular, it relies on the date validation being done last, after everything else has been checked properly.

    Something along these lines should work:

    TrustManagerFactory tmf = TrustManagerFactory.getInstance(
        TrustManagerFactory.getDefaultAlgorithm());
    // Initialise the TMF as you normally would, for example:
    tmf.init((KeyStore)null); 
    
    TrustManager[] trustManagers = tmf.getTrustManagers();
    final X509TrustManager origTrustmanager = (X509TrustManager)trustManagers[0];
    
    TrustManager[] wrappedTrustManagers = new TrustManager[]{
       new X509TrustManager() {
           public java.security.cert.X509Certificate[] getAcceptedIssuers() {
              return origTrustmanager.getAcceptedIssuers();
           }
    
           public void checkClientTrusted(X509Certificate[] certs, String authType) {
               origTrustmanager.checkClientTrusted(certs, authType);
           }
    
           public void checkServerTrusted(X509Certificate[] certs, String authType) {
               try {
                   origTrustmanager.checkServerTrusted(certs, authType);
               } catch (CertificateExpiredException e) {}
           }
       }
    };
    
    SSLContext sc = SSLContext.getInstance("TLS");
    sc.init(null, wrappedTrustManagers, null);
    HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
    

    The trust managers throw CertificateExceptions (see subclasses for details) when something is wrong with a certificate. Be specific in what you want to catch/ignore. Everything you really want validated has to be checked before what you catch is potentially thrown, or you’ll have to validate it manually too. Anything more relaxed than this (in particular, not doing anything and therefore not throwing any exception) will ignore the certificate verification and validation altogether, which is about the same as using anonymous cipher suites or ignoring authentication. This would defeat the security purpose of using SSL/TLS (as opposed to being only a bit more flexible on the expiry date).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

MyObject myobject= new MyObject(); myobject.name=Test; myobject.address=test; myobject.contactno=1234; string url = http://www.myurl.com/Key/1234 ? + myobject;
Let's say I have the following jQuery AJAX call: $.ajax({ type: POST, url: MyUrl,
I found the following code to create a tinyurl.com url: http://tinyurl.com/api-create.php?url=http://myurl.com This will automatically
Say in my web.xml file, I define a servlet like so: <url-pattern>/MyURL/*</url-pattern> How do
My URL is: http://www.metroflatsmiami.com/listing/add.html Any help?
Suppose this is my URL route: (r'^test/?$','hello.life.views.test'), How do I make it so that
I have this code: using ( var site = new SPSite( myUrl ) )
I've just set up a new webiste http://www.reviewongadgets.com But there is a problem with
I have a URL encoded resource such as: http://myurl/users/Joe%20Bloggs/index.xml This is for a RESTful
If I pass http://www.ebay.com to this. Somewhere along the way ebay changes my url,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.