encrypt « cfg « JPA Q&A





2. Encrypt password in hibernate.cfg.xml    forum.hibernate.org

I suppose you can do something like this Code: Configuration loConfig =new Configuration(file); String loPassword = loConfig.getProperty("connection.password") loPassword = decrypt(loPassword, someKey); loConfig.setProperty("connection.password", loPassword); loConfig.configure(); But this won't make your code secure. It just makes it a bit more difficult to get the password. You need to get the key from somewhere. It is either harcoded or in config file ( i ...

3. How to encrypt Database password in hibernate.cfg.xml    forum.hibernate.org

private void prepareConnection() throws ConnectorException { try { StandardPBEStringEncryptor strongEncryptor = new StandardPBEStringEncryptor(); HibernatePBEEncryptorRegistry registry = HibernatePBEEncryptorRegistry.getInstance(); registry.registerPBEStringEncryptor("configurationHibernateEncryptor", strongEncryptor); ...