first
This commit is contained in:
27
src/main/java/jwtSample.java
Normal file
27
src/main/java/jwtSample.java
Normal file
@@ -0,0 +1,27 @@
|
||||
import org.jasypt.encryption.StringEncryptor;
|
||||
import org.jasypt.encryption.pbe.PooledPBEStringEncryptor;
|
||||
import org.jasypt.encryption.pbe.config.SimpleStringPBEConfig;
|
||||
|
||||
public class jwtSample {
|
||||
private static final String SECRET_KEY = "5840f916c19111ee86fcf38ac250f21377907a8ac19111eebab6e7179f8e5c87";
|
||||
public static void main(String[] args) {
|
||||
System.out.println(stringEncryptor().decrypt("gLQTvX57MBGvHAhEGckIJbVdgG5w1YPO+bZk5+xOvg6DhAIcGcyXib8T605t2Icd"));
|
||||
System.out.println(stringEncryptor().decrypt("KpBRMJPNmBe/zi0mPo32beSSXteAaSEp/Kf7dVV3ss8Qi4mS2bJ+P0eFw2Qs15sV"));
|
||||
}
|
||||
|
||||
public static StringEncryptor stringEncryptor() {
|
||||
PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor();
|
||||
SimpleStringPBEConfig config = new SimpleStringPBEConfig();
|
||||
|
||||
config.setPassword("kospo2025"); // 암호화키
|
||||
config.setAlgorithm("PBEWITHHMACSHA512ANDAES_256"); // 알고리즘
|
||||
config.setKeyObtentionIterations("1000"); // 반복할 해싱 회수
|
||||
config.setPoolSize("1"); // 인스턴스 pool
|
||||
config.setProviderName("SunJCE");
|
||||
config.setSaltGeneratorClassName("org.jasypt.salt.RandomSaltGenerator"); // salt 생성 클래스
|
||||
config.setIvGeneratorClassName("org.jasypt.iv.RandomIvGenerator");
|
||||
config.setStringOutputType("base64"); //인코딩 방식
|
||||
encryptor.setConfig(config);
|
||||
return encryptor;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user