From 1414f8993a616a8dc2d5430e3a646e3075b87b57 Mon Sep 17 00:00:00 2001
From: Valery Kharseko <vharseko@3a-systems.ru>
Date: Thu, 03 Sep 2026 08:07:08 +0000
Subject: [PATCH] [#905] Warn when a replication handshake fails and document CA-signed certificates (#906)

---
 opendj-server-legacy/src/main/java/org/opends/server/backends/TrustStoreBackend.java |   40 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/TrustStoreBackend.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/TrustStoreBackend.java
index 95f8cce..a1d58fd 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/TrustStoreBackend.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/TrustStoreBackend.java
@@ -13,6 +13,7 @@
  *
  * Copyright 2007-2010 Sun Microsystems, Inc.
  * Portions Copyright 2011-2016 ForgeRock AS.
+ * Portions Copyright 2026 3A Systems, LLC.
  */
 package org.opends.server.backends;
 
@@ -822,6 +823,45 @@
     }
   }
 
+  /**
+   * Retrieves the path to the file which holds this trust store.
+   *
+   * @return  The path to the file which holds this trust store.
+   */
+  public String getTrustStoreFile()
+  {
+    return trustStoreFile;
+  }
+
+  /**
+   * Indicates whether this trust store holds a key entry, that is a private key
+   * and its certificate, under the provided alias. The alias is matched the way
+   * the key store itself matches it, without regard to case for the JKS and
+   * PKCS12 store types.
+   *
+   * @param  alias  The alias to look for.
+   *
+   * @return  {@code true} if this trust store holds a key entry under the
+   *          provided alias, {@code false} otherwise.
+   *
+   * @throws  DirectoryException  If the trust store cannot be read.
+   */
+  public boolean containsKeyWithAlias(String alias) throws DirectoryException
+  {
+    final KeyStore keyStore = loadKeyStore();
+    try
+    {
+      return keyStore.isKeyEntry(alias);
+    }
+    catch (KeyStoreException e)
+    {
+      logger.traceException(e);
+
+      LocalizableMessage message = ERR_TRUSTSTORE_CANNOT_LOAD.get(trustStoreFile, getExceptionMessage(e));
+      throw new DirectoryException(DirectoryServer.getCoreConfigManager().getServerErrorResultCode(), message, e);
+    }
+  }
+
   private KeyStore loadKeyStore() throws DirectoryException
   {
     try (FileInputStream inputStream = new FileInputStream(getFileForPath(trustStoreFile)))

--
Gitblit v1.10.0