]> git.datanom.net - vault.git/blob - src/test/java/dk/cbs/soa/soasi/secret/vault/security/AesGcmTest.java
Add encryption
[vault.git] / src / test / java / dk / cbs / soa / soasi / secret / vault / security / AesGcmTest.java
1 package dk.cbs.soa.soasi.secret.vault.security;
2
3 import static org.junit.jupiter.api.Assertions.*;
4
5 import org.junit.jupiter.api.Test;
6 import org.springframework.beans.factory.annotation.Autowired;
7 import org.springframework.boot.test.context.SpringBootTest;
8
9 import lombok.extern.slf4j.Slf4j;
10
11 @SpringBootTest
12 @Slf4j
13 class AesGcmTest {
14
15 @Autowired
16 private AesGcm aesGcm;
17
18 @Test
19 void test() {
20 String expected = "This text is going to be encrypted";
21 String password = "This is the Big Secret 1234";
22
23 log.info("Plain: {}", expected);
24 String cipher = aesGcm.encrypt(expected, password);
25 log.info("Cipher: {}", cipher);
26 String plain = aesGcm.decrypt(cipher, password);
27 log.info("Decrypted: {}", plain);
28
29 assertEquals(expected, plain);
30 }
31
32 }
This page took 0.516959 seconds and 6 git commands to generate.