-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: How to secure the datasource?
PostPosted: Tue Jan 15, 2008 11:12 am 
Newbie

Joined: Tue Jan 24, 2006 12:11 pm
Posts: 7
We define some information like usename and password as plaintext in the datasource. May I know if any open souce on how to encrpt this database information, and integrate it with hibernate configuration? specilly under J2SE enviromant.

thanks,


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 15, 2008 1:57 pm 
Senior
Senior

Joined: Fri Jun 01, 2007 12:41 pm
Posts: 121
You can do some thing like:

-Store the database details in secure store encrypted
-Read them from your Hibernate class that configures the SessionFactory
-Add those properties to Configuration object and configure your session factory.

Code:
//hibernateConfURL - myhibernate.cfg.xml
Configuration config= new Configuration();
            config.configure(hibernateConfURL);
            String user = "user"; //read it from secure store
          String password = "password"; //read it from secure store
         
      config.setProperty(Environment.USER, password);
      config.setProperty(Environment.PASS, password);
           SessionFactory sessionFactory = config.buildSessionFactory();


Here you can store user name and password encrypted in a file and read them from your program and decrypt them

Thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.