Make Be BackEnd
[Jasypt] nested exception is org.jasypt.exceptions.EncryptionOperationNotPossibleException 본문
Error
[Jasypt] nested exception is org.jasypt.exceptions.EncryptionOperationNotPossibleException
Initsave 2024. 6. 4. 15:23
현상
properties 의 값을 복호화 하는 과정에서 에러가 발생했다.
원인
properties의 값을 불러오는 메서드에서 문제가 발생했다.
1. FileInputStream 경로가 제대로 지정되지 않아서 생긴 문제
2. properties 에서 ENC() 형식의 문자열도 포함되어서 복호화가 되지 않았다.
해결
1. 클래스 패스에 있는 파일과 경로를 따로 얻어와서 FileInputStream을 사용
2. 암호화를 위해서 변환했던 형식의 ENC()를 제외하고 실제 값을 복호화
// 클래스패스에서 파일 경로를 얻어옴
String filePath = CommonUtil.class.getClassLoader().getResource(properPath).getFile();
File configFile = new File(filePath);
input = new FileInputStream(configFile);
prop.load(input);
return prop.getProperty(propertiesKey);
// 실제 값 가져오기
appUsername.substring(4,appUsername.length()-1);