From 7b47913bc8c39f2c35ffb2681c5663064d8e5203 Mon Sep 17 00:00:00 2001 From: Roman Strobl Date: Thu, 14 Nov 2024 13:50:41 +0800 Subject: [PATCH] Fix #766: Failing test testEncryptionAndDecryptionDifferentActivationFailServerPrivateKeyConverter --- .../app/server/ServerPrivateKeyConverterTest.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/powerauth-java-server/src/test/java/io/getlime/security/powerauth/app/server/ServerPrivateKeyConverterTest.java b/powerauth-java-server/src/test/java/io/getlime/security/powerauth/app/server/ServerPrivateKeyConverterTest.java index 9a728aed6..62cb489bf 100644 --- a/powerauth-java-server/src/test/java/io/getlime/security/powerauth/app/server/ServerPrivateKeyConverterTest.java +++ b/powerauth-java-server/src/test/java/io/getlime/security/powerauth/app/server/ServerPrivateKeyConverterTest.java @@ -95,8 +95,13 @@ void testEncryptionAndDecryptionDifferentActivationFailServerPrivateKeyConverter final ServerPrivateKey serverPrivateKeyEncrypted = serverPrivateKeyConverter.toDBValue(serverPrivateKeyBytes, USER_ID, ACTIVATION_ID); assertEquals(EncryptionMode.AES_HMAC, serverPrivateKeyEncrypted.encryptionMode()); - assertThrows(GenericServiceException.class, () -> - serverPrivateKeyConverter.fromDBValue(serverPrivateKeyEncrypted, USER_ID, "115286e0-e1c5-4ee1-8d1b-c6947cab0a56")); + + try { + String decryptedPrivateKeyBase64 = serverPrivateKeyConverter.fromDBValue(serverPrivateKeyEncrypted, USER_ID, "115286e0-e1c5-4ee1-8d1b-c6947cab0a56"); + assertNotEquals(decryptedPrivateKeyBase64, SERVER_PRIVATE_KEY_PLAIN); + } catch (GenericServiceException ex) { + assertEquals("Generic cryptography error occurred.", ex.getMessage()); + } } }