-->
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.  [ 4 posts ] 
Author Message
 Post subject: Hibernate & mysql md5 password
PostPosted: Tue Feb 10, 2004 9:38 am 
Beginner
Beginner

Joined: Wed Nov 19, 2003 3:08 pm
Posts: 20
Hi

Earlier we have put passwords to mysql table with PHP and following sql script:

insert into table set password = md5('secred')

and now old software will be replaced with new java version, where i have used hibernate.
Does hibernate support same kind functionality, or how to solve problem?
I have tried to create same md5 checksum with java, but it wont work.
MessageDigest md = MessageDigest.getInstance("MD5");
String sec = "secred";
byte out[] = md.digest(sec.getBytes("ASCII"));

Any hints?!??

Artsi


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 10, 2004 9:50 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
This has been discussed sometimes allready, with the result of it being not officially supported and not that easy to implement yourself. See http://forum.hibernate.org/viewtopic.php?t=251&highlight=password for example.


Top
 Profile  
 
 Post subject: CoolThnx
PostPosted: Tue Feb 10, 2004 9:52 am 
Beginner
Beginner

Joined: Wed Nov 19, 2003 3:08 pm
Posts: 20
Thanks, your reply was very fast! i will consult your link.

Artsi


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 10, 2004 10:01 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
I would suggest you map it as a plain string property and create your own password encryption utility function you use to encrypt the password before setting it on the object or using it in a query. For compatibility with old encrypted passwords, you can make this function call something like "SELECT md5(?) from sometable" through a plain JDBC connection.

Somehow it must also be possible to encrypt passwords the same way as mysql using a MessageDigest.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.