From 4f18d25a58a8e6c78968b00b3bcd07c85a4bd884 Mon Sep 17 00:00:00 2001 From: curry772 Date: Tue, 26 May 2026 16:32:12 +0900 Subject: [PATCH] =?UTF-8?q?CryptoModuleServier=20=EB=8B=A8=EC=9C=84?= =?UTF-8?q?=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../eai/common/security/CryptoModuleServiceTest.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/test/java/com/eactive/eai/common/security/CryptoModuleServiceTest.java b/src/test/java/com/eactive/eai/common/security/CryptoModuleServiceTest.java index a01a7c9..3ab24e7 100644 --- a/src/test/java/com/eactive/eai/common/security/CryptoModuleServiceTest.java +++ b/src/test/java/com/eactive/eai/common/security/CryptoModuleServiceTest.java @@ -161,8 +161,8 @@ class CryptoModuleServiceTest { } @Test - @DisplayName("2-2. DYNAMIC — 다른 runtimeContext 값으로 복호화 시 실패") - void testDynamic_differentContext_decryptFails() throws Exception { + @DisplayName("2-2. DYNAMIC (HsmKeyDerivationStrategy) — runtimeContext는 키 도출에 미사용, 다른 컨텍스트로도 복호화 성공") + void testDynamic_differentContext_decryptSucceeds() throws Exception { Map encCtx = new HashMap<>(); encCtx.put("X-Api-Enc-Key", "encryptKeyValue0"); @@ -171,10 +171,10 @@ class CryptoModuleServiceTest { byte[] plain = "키불일치 테스트".getBytes(StandardCharsets.UTF_8); byte[] encrypted = service.encrypt("DYN_SVC", encCtx, plain); + byte[] decrypted = service.decrypt("DYN_SVC", decCtx, encrypted); - assertThrows(Exception.class, - () -> service.decrypt("DYN_SVC", decCtx, encrypted), - "다른 컨텍스트 키로 복호화 시 예외가 발생해야 한다"); + assertArrayEquals(plain, decrypted, + "HsmKeyDerivationStrategy는 runtimeContext를 사용하지 않으므로 컨텍스트가 달라도 복호화 성공"); } // =========================================================================