From 2863452733f1815ce5557ff01cfe148b49e182b0 Mon Sep 17 00:00:00 2001
From: Valery Kharseko <vharseko@3a-systems.ru>
Date: Mon, 30 Nov 2026 16:00:33 +0000
Subject: [PATCH] [#1208] Retry the discovery responder before declaring replication isolation (#1349)

---
 opendj-server-legacy/src/test/java/org/opends/server/crypto/RsaSveKeyTransportTestCase.java |   19 +++++++++----------
 1 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/opendj-server-legacy/src/test/java/org/opends/server/crypto/RsaSveKeyTransportTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/crypto/RsaSveKeyTransportTestCase.java
index af31ca5..10f7b10 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/crypto/RsaSveKeyTransportTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/crypto/RsaSveKeyTransportTestCase.java
@@ -120,19 +120,18 @@
   @Test
   public void testAnotherPrivateKeyCannotUnwrap() throws Exception
   {
-    KeyPair other;
-    do
-    {
-      other = rsaKeyPair(2048);
-    }
-    while (modulus(other).compareTo(modulus(keyPair)) <= 0);
-    final KeyPair otherKeyPair = other;
+    final KeyPair secondKeyPair = rsaKeyPair(2048);
+    final int modulusOrder = modulus(keyPair).compareTo(modulus(secondKeyPair));
+    assertThat(modulusOrder).as("the two RSA moduli must differ").isNotZero();
+    final KeyPair wrappingKeyPair = modulusOrder < 0 ? keyPair : secondKeyPair;
+    final KeyPair wrongKeyPair = modulusOrder < 0 ? secondKeyPair : keyPair;
     final SecretKey key = new SecretKeySpec(bytes(16, 0x3C), "AES");
     inProviders(BC_FIPS, () ->
     {
-      final byte[] wrapped = RsaSveKeyTransport.wrap(keyPair.getPublic(), key, KEY_ID, random);
-      assertThatThrownBy(() -> RsaSveKeyTransport.unwrap(otherKeyPair, wrapped, "AES", KEY_ID))
-          .isInstanceOf(GeneralSecurityException.class);
+      final byte[] wrapped = RsaSveKeyTransport.wrap(wrappingKeyPair.getPublic(), key, KEY_ID, random);
+      assertThatThrownBy(() -> RsaSveKeyTransport.unwrap(wrongKeyPair, wrapped, "AES", KEY_ID))
+          .isInstanceOf(InvalidKeyException.class)
+          .hasMessage(RsaSveKeyTransport.NAME + " cannot unwrap the key");
       return null;
     });
   }

--
Gitblit v1.10.0