1: …… 2: public boolean DBConnect() throws SQLException { 3: String url = "DBServer"; 4: String usr = "Scott"; 5: Connection con = null; 6: 7: try { 8: Properties prop = new Properties(); 9: prop.load(new FileInputStream("config.properties")); 10: 11: // 패스워드를 AES 알고리즘 기반의 복호화 코드로 암호화 한다. 12: String password = decrypt(prop.getProperty("password" )); 13: 14: con = DriverManager.getConnection(url, usr, password); 15: } catch (FileNotFoundException e) { 16: e.printStackTrace(); 17: } catch (IOException e) { 18: e.printStackTrace(); 19: } 20: } 21: private static String decrypt(String encrypted) throws Exception { 22: SecretKeySpec skeySpec = new SecretKeySpec(key.getBytes(), "AES"); 23: Cipher cipher = Cipher.getInstance("AES"); 24: cipher.init(Cipher.DECRYPT_MODE, skeySpec); 25: byte[] original = cipher.doFinal(hexToByteArray(encrypted)); 26: return new String(original); 27: }