If you happen to be using the Apache Commons Codec package, you can
use DigestUtils to simplify hashing the password. (You don't actually
want to encrypt the password, just hash it). In your subclass (the
non-underscore one), add something like:
public setPassword(String plaintextPassword)
{
String hashedPassword = DigestUtils.sha256Hex(plaintextPassword);
super.setPassword(hashedPassword);
}
Here is the JavaDoc for DigestUtils:
http://commons.apache.org/codec/api-release/org/apache/commons/codec/digest/DigestUtils.html
Be sure your password field is big enough. For SHA-266, I think you'd
need 64 characters.
mrg
On Sat, Jan 23, 2010 at 9:37 PM, Joe Baldwin <jfbaldwi..arthlink.net> wrote:
> Hi,
>
> I had this very same question some time ago, and the overwhelming opinion was to use the Java encryption over a DBMS-specific solution. I am using the javax.crypto package. I handle the encryption with a wrapper class and simply store the resulting string in the database using standard Cayenne.
>
> I now agree with all of those people who suggested that I go with the standard Java encryption vs MySQL.
>
> Hope this helps,
> Joe
>
>
> On Jan 23, 2010, at 3:34 PM, Nishant Neeraj wrote:
>
>> Hi,
>>
>> Is there a way in Cayenne to use MySQL's encryption functions to store encrypt and store password?
>>
>> Thanks
>> -Nishant
>>
>>
>> Your Mail works best with the New Yahoo Optimized IE8. Get it NOW! http://downloads.yahoo.com/in/internetexplorer/
>
>
This archive was generated by hypermail 2.0.0 : Sun Jan 24 2010 - 23:36:29 EST