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

  • SEARCH
  • Home
  • 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 6680859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:31:26+00:00 2026-05-26T04:31:26+00:00

I use the following TrustManager to accept self-signed certificates from my local test server

  • 0

I use the following TrustManager to accept self-signed certificates from my local test server in my Java application:

public class CertificateAcceptor {

    private TrustManager[] createTrustManager() {
        TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() {

            public X509Certificate[] getAcceptedIssuers() {
                return null;
            }

            public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
                // leave blank to trust every client
            }

            public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
                // leave blank to trust every client
            }
        }};
        return trustAllCerts;
    }

I have some security concerns with that, since as far as I know, this accepts just all certificates. So I’m asking myself if there is a way to only accept certificates that are coming from localhost on Port 9443?

  • 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-26T04:31:28+00:00Added an answer on May 26, 2026 at 4:31 am

    Assuming that these are your self-signed certificates and not just any self-signed certificates, it would probably make better sense to create your own certificate authority so you can have valid, signed certificates instead of creating work arounds and losing the benefits of have certificates.

    By creating your own CA you can sign your own certificates and then simply import the CA certificate into your Java keystore. Then no more problems with self-signed certs. Plus you have the added benefit of being able to trust the certificate (assuming you take good care of your certificate keys).

    Being your own CA is actually much easier than you might think. At least that was the case for me.

    Here is a link with some step-by-step instructions.
    http://sandbox.rulemaker.net/ngps/m2/howto.ca.html

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

Sidebar

Related Questions

I try to connect to a server with a self-signed certificate. I use this
I use following function to convert datetimes from UTC to my local time (West
I use following method to get var from another class. However, firstView receives always
I use following command to dump some structures from server' database to be able
for example i use following command to find a record SELECT `users`.`mail` FROM `users`
Hello Sir i want send list of data to php server i use following
i am creating simple call filter application which restrict unwanted calls. i use following
I use the following function to show controls on my form: class procedure TFormMain.FadeControls(ctrl:Array
I have a class similar to the following: public abstract class Manager<T, TInterface> :
I use following PHP function: file_get_contents('http://example.com'); Whenever I do this on a certain server,

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.