1. 新增外部系统编码部门编码关联管理

2. 新增统一的 api 对外门户管理
3. 修正各个模块的 api 命名
This commit is contained in:
chenbowen
2025-10-17 17:40:46 +08:00
parent ce8e06d2a3
commit 78bc88b7a6
106 changed files with 4200 additions and 1377 deletions

View File

@@ -0,0 +1,50 @@
package com.zt.plat.framework.common.util.security;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
class CryptoSignatureUtilsTest {
@Test
void decryptShouldIgnoreWhitespaceInCiphertext() {
String key = "test-key";
String plaintext = "{\"sample\":123}";
String encrypted = CryptoSignatureUtils.encrypt(plaintext, key, CryptoSignatureUtils.ENCRYPT_TYPE_AES);
int splitIndex = Math.max(1, encrypted.length() / 2);
String cipherWithWhitespace = " " + encrypted.substring(0, splitIndex)
+ " \n\t "
+ encrypted.substring(splitIndex);
String decrypted = CryptoSignatureUtils.decrypt(cipherWithWhitespace, key, CryptoSignatureUtils.ENCRYPT_TYPE_AES);
assertEquals(plaintext, decrypted);
}
@Test
void decryptShouldRestorePlusCharactersConvertedToSpaces() {
String key = "test-key";
String basePlaintext = "payload-";
String encryptedWithPlus = null;
String chosenPlaintext = null;
for (int i = 0; i < 100; i++) {
String candidatePlaintext = basePlaintext + i;
String candidateEncrypted = CryptoSignatureUtils.encrypt(candidatePlaintext, key, CryptoSignatureUtils.ENCRYPT_TYPE_AES);
if (candidateEncrypted.indexOf('+') >= 0) {
encryptedWithPlus = candidateEncrypted;
chosenPlaintext = candidatePlaintext;
break;
}
}
assertNotNull(encryptedWithPlus, "Expected to generate ciphertext containing '+' character");
String mutatedCipher = encryptedWithPlus.replace('+', ' ');
String decrypted = CryptoSignatureUtils.decrypt(mutatedCipher, key, CryptoSignatureUtils.ENCRYPT_TYPE_AES);
assertEquals(chosenPlaintext, decrypted);
}
}