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 133311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T06:24:35+00:00 2026-05-11T06:24:35+00:00

I have a pkcs12 file. I need to use this to connect to a

  • 0

I have a pkcs12 file. I need to use this to connect to a webpage using https protocol. I came across some code where in order to connect to a secure web page i need to set the following system properties:

System.setProperty('javax.net.ssl.trustStore', 'myTrustStore'); System.setProperty('javax.net.ssl.trustStorePassword', 'changeit'); System.setProperty('javax.net.ssl.keyStoreType', 'pkcs12'); System.setProperty('javax.net.ssl.keyStore', 'new_cert.p12'); System.setProperty('javax.net.ssl.keyStorePassword', 'newpass'); 

I have the p12(pkcs12) file. All I need is a truststore file.

I extracted the certificates using:

openssl.exe pkcs12 -in c:/mykey.p12 -out c:/cert.txt -nokeys -clcerts 

Now converted the cert PEM file to der

openssl.exe x509 -in c:/cert.txt -outform DER -out c:/CAcert.der  

Now adding the der file to a keystore

keytool -import -file C:/Cacert.der -keystore mytruststore 

Now I have the truststore, but when I use it, I get the following error

Exception in thread 'main' java.net.SocketException: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl) 

Update: After removing certain properties and setting only the ‘trustStore’, ‘trustStorePassword’ and ‘trustStoreType’ property, I got the following exception

java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty 

Please Help.

  • 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. 2026-05-11T06:24:35+00:00Added an answer on May 11, 2026 at 6:24 am

    For anyone encountering a similar situation I was able to solve the issue above as follows:

    1. Regenerate your pkcs12 file as follows:

      openssl pkcs12 -in oldpkcs.p12 -out keys -passout pass:tmp openssl pkcs12 -in keys -export -out new.p12 -passin pass:tmp -passout pass:newpasswd 
    2. Import the CA certificate from server into a TrustStore ( either your own, or the java keystore in $JAVA_HOME/jre/lib/security/cacerts, password: changeit).

    3. Set the following system properties:

      System.setProperty('javax.net.ssl.trustStore', 'myTrustStore'); System.setProperty('javax.net.ssl.trustStorePassword', 'changeit'); System.setProperty('javax.net.ssl.keyStoreType', 'pkcs12'); System.setProperty('javax.net.ssl.keyStore', 'new.p12'); System.setProperty('javax.net.ssl.keyStorePassword', 'newpasswd'); 
    4. Test ur url.

    Courtesy@ http://forums.sun.com/thread.jspa?threadID=5296333

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

Sidebar

Ask A Question

Stats

  • Questions 73k
  • Answers 73k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Why don't you use an inline helper function which gets… May 11, 2026 at 1:55 pm
  • added an answer The term was coined in Ted Neward's book 'Server-based Java… May 11, 2026 at 1:55 pm
  • added an answer This isn't easily explained in a StackOverflow post, particularly since… May 11, 2026 at 1:55 pm

Related Questions

Backstory: I have a PKCS#12 (p12) certificate with a symmetric cipher (password) that I
I have a web-service that I will be deploying to dev, staging and production.
I have a .Net desktop application with a TreeView as one of the UI
I have a Queue<T> object that I have initialised to a capacity of 2,
I have a complete XML document in a string and would like a Document
I can't believe I'm the only person to run up against this problem. I've
I'm trying to understand what the Java java.security.Signature class does. If I compute an

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.