Is it possible to encrypt the connection password to the database that is inside a Java application?

Asked

Viewed 135 times

1

I have an application in Java and using the Postgresql database. To connect to the database I use this method:

    public static Connection getConnection() throws Exception {
        try {
            Class.forName("org.postgresql.Driver");
            Connection connection = DriverManager.getConnection(Constantes.URL_BD, Constantes.USUARIO_BD, Constantes.SENHA_BD);

            return connection;

        } catch (Exception e) {
            throw new Exception(e.getMessage());
        }
    }

I wonder if when passing the password to the getConnection() method of Drivermanager it may be encrypted in some way... whether using md5 or other hash.

  • 1

    Why do you want this result? Let’s try to treat the reason why.

  • I want to do this in case someone gets access to my application, whether by source code or reverse engineering can’t read the password

  • Your application is Desktop communicating with a remote database?

  • This run by command line . jar

  • How do you use the bank? Is it feasible to separate in this CLI front-end and a service that communicates with the bank? (Service located in a controlled environment)

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.