23 lines
908 B
Java
23 lines
908 B
Java
package ru.pdguard;
|
||
|
||
import org.junit.jupiter.api.Test;
|
||
import ru.pdguard.core.PayloadCipher;
|
||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||
|
||
/** Проверка ключа шифрования из application.yml. */
|
||
class CipherKeyTest {
|
||
|
||
private static final String KEY = "46a38b200c6df557a5fd2c8a57ad3fec6b710b9f3e1fef1451d121a094f63573";
|
||
|
||
@Test
|
||
void keyIsValidAes256() {
|
||
PayloadCipher cipher = new PayloadCipher(KEY);
|
||
assertTrue(cipher.enabled(), "ключ должен включать шифрование");
|
||
String original = "Клиент Иванов Иван Иванович, паспорт 4509 123456";
|
||
assertEquals(original, cipher.decrypt(cipher.encrypt(original)),
|
||
"round-trip с ключом из application.yml должен работать");
|
||
}
|
||
}
|