하드코딩된 비밀번호 사용 (Hardcoded Password)
Use of Hard-Coded Password
Last updated
Use of Hard-Coded Password
Last updated
import java.security.KeyStore;
public class InsecurePasswordExample {
public void loadKeyStore() throws Exception {
KeyStore keyStore = KeyStore.getInstance("JKS");
keyStore.load(null, "hardcoded_password".toCharArray()); // 하드코딩된 비밀번호
}
}import java.security.KeyStore;
public class SecurePasswordExample {
public void loadKeyStore() throws Exception {
String password = System.getenv("KEYSTORE_PASSWORD"); // 환경 변수에서 비밀번호 로드
if (password == null) {
throw new SecurityException("Keystore password is not set");
}
KeyStore keyStore = KeyStore.getInstance("JKS");
keyStore.load(null, password.toCharArray());
}
}