Validate certification path with intermediate cert

General Tech QA/Testing 2 years ago

0 1 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Posted on 16 Aug 2022, this text provides information on QA/Testing related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (1)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago

 

I am trying to validate certification path with domain cert and intermediate cert. The cert do not contain root cert. Is there a way to verify cert path with no root cert provided?

Thanks

---Update---- Method that I have tried on

        InputStream trustStoreInput = new FileInputStream(cacertPath);
        String password = password;

        KeyStore anchors = KeyStore.getInstance(KeyStore.getDefaultType());
        anchors.load(trustStoreInput, password.toCharArray());
        X509CertSelector target = new X509CertSelector();

        target.setCertificate(certList.get(1)); <---I have domain cert and intermediate cert
        PKIXBuilderParameters params = new PKIXBuilderParameters(anchors, target);
        CertStoreParameters intermediates = new CollectionCertStoreParameters(certList);
        params.addCertStore(CertStore.getInstance("Collection", intermediates));
        CertPathBuilderResult result = CertPathBuilder.getInstance("PKIX").build(params);

But I got this error

 unable to find valid certification path to requested target
0 views
0 shares

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.