Spring and encrypted DataSource passwords

August 15, 2005

One of the limitations of using Spring outside of the traditional J2EE container is hard-coding database information inside the Spring configuration file. If you are deploying the application inside the container, you can simply reference the DataSource via JNDI and not have to provide login, password information about the database connection. To work around that issue, Matt has extended Spring implementation of javax.sql.Datasource and added support for hashing/encrypting the database password. Permalink to Matt’s blog is here .

Spring, DataSource, Encryption

Advertisements

4 Responses to “Spring and encrypted DataSource passwords”

  1. As I commented on Matt’s blog – what’s the point to encrypt password with reversible algorithm and keep the key as an open string? Does it adds security really?

  2. Hi Dmitri. I agree with you in principal but the idea of using 2-way encryption is part of the ‘Defense in depth‘ strategy. Encrypting the password and separating the key makes it a little harder for someone to get access to the database. The key needed to decrypt could be placed in a directory where you can use UNIX permissions to restrict access – It’s not perfect but you are adding layers of security.

  3. Vinny,

    I hear what you saying but for me false sence of security is actually worse than no security at all 😉 Users looking at *Secure*DriverManagerDataSource would assume that they’re much better protected when in reality this won’t stop anybody who even little determined to break into this.

    Following your logic, whole application context could be placed in the directory where you can use persmissions to restrict access to it (but app. server still going to need read permissions) 😉

    PS Java keystore, though not ideal in may ways, was designed to prevent keys from being kept in open.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: