I have a Java web application that uses a servlet to store userids and
encrypted passwords, as well as a stored procedure on the AS400 that
checks to see if the password is correct.

I'm having an problem where certain passwords (e.g. 'password99')
always fail when the stored procedure checks the encrypted passwords
against each other.

Below is a code sniplet of the encryption. The String returned gets
stored via JDBC into the AS400.

Is there some issue with storing UTF-8 characters in the DB2 database?
Should I use EBCDIC-US instead?

Any help would be greatly appreciated. Thanks in advance.
-- 
Brett Slocum
<slocum@xxxxxxxxxxxxxx>
---------------------------------------------------------------
Code Sniplet:

    public static String encrypt(String data) {
        String encrypted_Data = null;
        MessageDigest md = null;
        try{
            md = MessageDigest.getInstance("SHA-1");
            md.update(data.getBytes("UTF-8"));
            byte[] result = md.digest();
            encrypted_Data = new String(result, "UTF-8");
        } catch(Exception e) {
            e.printStackTrace();
        }
        return encrypted_Data;
    }

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.