forked from jeesun/oauthserver
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUtilTests.java
More file actions
22 lines (19 loc) · 783 Bytes
/
UtilTests.java
File metadata and controls
22 lines (19 loc) · 783 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package com.simon;
import org.jasypt.util.text.BasicTextEncryptor;
import org.junit.Test;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
public class UtilTests {
@Test
public void jasyptTest(){
BasicTextEncryptor encryptor = new BasicTextEncryptor();
encryptor.setPassword("19941017");//application.yml配置的jasypt.encryptor.password
String encrypted = encryptor.encrypt("postgres");//要加密的数据(数据库连接的用户名或密码)
System.out.println(encrypted);
}
@Test
public void bCryptPasswordEncoderTest(){
BCryptPasswordEncoder encoder = new BCryptPasswordEncoder(11);
String passEncode = encoder.encode("secret");
System.out.println(passEncode);
}
}