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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:35:47+00:00 2026-06-09T07:35:47+00:00

I have a self written java server that may have multiple keys (1 key

  • 0

I have a self written java server that may have multiple keys (1 key used for connection and another key for rollover in case the first one expired) in its keystore so I tried reading the keystore and then constructing an ephemeral keystore with only one key to pass to the SSLContext when I need to start the server. However, it doesn’t seem to work:

On the client side I get:

javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
sun.security.ssl.Alerts.getSSLException(Unknown Source)
sun.security.ssl.SSLSocketImpl.fatal(Unknown Source)
sun.security.ssl.SSLSocketImpl.fatal(Unknown Source)
sun.security.ssl.SSLSocketImpl.handleException(Unknown Source)
sun.security.ssl.SSLSocketImpl.handleException(Unknown Source)
sun.security.ssl.AppOutputStream.write(Unknown Source)
java.io.BufferedOutputStream.flushBuffer(Unknown Source)
java.io.BufferedOutputStream.flush(Unknown Source)
com.netrust.protocol.ProtocolClient.initialize(ProtocolClient.java:41)
com.netrust.clientregistrar.gui.Client.connect(Client.java:501)
com.netrust.clientregistrar.gui.Client.sendGetDirectoryChangeLog(Client.java:108)
com.netrust.clientregistrar.gui.ServerTreeModel.refresh(ServerTreeModel.java:195)
com.netrust.clientregistrar.gui.ServerTreeModel.refresh(ServerTreeModel.java:333)
com.netrust.clientregistrar.gui.ServerTreePanel.refresh(ServerTreePanel.java:189)
com.netrust.clientregistrar.gui.ClientRegistrarPanel.<init>(ClientRegistrarPanel.java:195)
com.netrust.clientregistrar.gui.Main.runApplication(Main.java:150)
com.netrust.clientregistrar.gui.Main.access$300(Main.java:26)
com.netrust.clientregistrar.gui.Main$1.run(Main.java:64)
java.awt.event.InvocationEvent.dispatch(Unknown Source)
java.awt.EventQueue.dispatchEventImpl(Unknown Source)
java.awt.EventQueue.access$000(Unknown Source)
java.awt.EventQueue$3.run(Unknown Source)
java.awt.EventQueue$3.run(Unknown Source)
java.security.AccessController.doPrivileged(Native Method)
java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
java.awt.EventQueue.dispatchEvent(Unknown Source)
java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
java.awt.EventDispatchThread.pumpEvents(Unknown Source)
java.awt.EventDispatchThread.pumpEvents(Unknown Source)
java.awt.EventDispatchThread.run(Unknown Source)

On the server side I get:

javax.net.ssl.SSLException: Received fatal alert: internal_error
sun.security.ssl.Alerts.getSSLException(Unknown Source)
sun.security.ssl.Alerts.getSSLException(Unknown Source)
sun.security.ssl.SSLSocketImpl.recvAlert(Unknown Source)
sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
com.netrust.server.ManagementSecureConnectionHandler.run(ManagementSecureConnectionHandler.java:96)
com.netrust.util.DynamicThreadPool$WorkerThread.run(DynamicThreadPool.java:295)

Relevant Code:

// marhalAsJKS()
Enumeration< String > aliases = keyStore.aliases();
String alias = null;
java.security.KeyStore jks = java.security.KeyStore.getInstance( java.security.KeyStore.getDefaultType() );
jks.load( null, oldPassword );
while ( aliases.hasMoreElements() )
{
    alias = aliases.nextElement();
    if ( keyStore.isKeyEntry( alias ) )
    {
        jks.setKeyEntry( alias,
                 keyStore.getKey( alias, oldPassword ),
                 oldPassword,
                 keyStore.getCertificateChain( alias ) );
    }
    else if ( keyStore.isCertificateEntry( alias ) )
    {
        jks.setCertificateEntry( alias, keyStore.getCertificate( alias ) );
    }
}
// Constructing ephemeral keystore and truststore
ephemeralKeyStore = managementKeyStore.marshalAsJKS();
ephemeralKeyStore.deleteEntry( PathRegistry.SERVER_KEY_ROLLOVER_ENTRY_ALIAS );
ephemeralTrustStore = managementKeyStore.marshalAsJKS();
ephemeralTrustStore.deleteEntry( PathRegistry.SERVER_KEY_ROLLOVER_ENTRY_ALIAS );
if ( generalConfiguration.isRootServerType() && managementKeyStore.isKeyEntry( PathRegistry.SERVER_KEY_ROLLOVER_ENTRY_ALIAS ) )
    ephemeralTrustStore.setCertificateEntry( PathRegistry.ROOT_CERTIFICATE_ROLLOVER_ENTRY_ALIAS,
                                     managementKeyStore.getCertificate( PathRegistry.SERVER_KEY_ROLLOVER_ENTRY_ALIAS ) );

// Initializing SSL
sslContext = SSLContext.getInstance( "TLS" );
keyManagerFactory.init( getKeyStore(), getKeyStorePassword() );
trustManagerFactory.init( getTrustStore() );
sslContext.init( keyManagerFactory.getKeyManagers(), trustManagerFactory.getTrustManagers(), null );
serverSocket = ( SSLServerSocket ) sslContext.getServerSocketFactory().createServerSocket( getPort() );

Similar Question but with 1 way SSL:
How can I have multiple SSL certificates for a Java server

  • 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-06-09T07:35:49+00:00Added an answer on June 9, 2026 at 7:35 am

    javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty

    This almost certainly comes from a trust manager in your client code that you’ve initialised with an empty trust store.

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

Sidebar

Related Questions

I have a self-written Java application - a little mail monitor. It works with
I have written a class in python that implements __str__(self) but when I use
I have Java webserver (no standard software ... self written) . Everything seems to
I have a server written ( self written - no Tomcat or Jetty )
I have written a quick Java wrapper that fires off the NMAP executable and
I have two websites with self written membership providers that are hostet on the
I have a problem with the Jakarta Commons HttpClient. Before my self-written HttpServer gets
I have a self-referential table in my database that looks sort of like above.
I have a self referencing table named categories that has a parentcategoryid column that
I have been attempting to enhance my GUI system written in Java to use

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.