GeeCON Prague 2014*
The moose likes EJB and other Java EE Technologies and the fly likes Need help with DigestUtils SHA encryption Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Need help with DigestUtils SHA encryption" Watch "Need help with DigestUtils SHA encryption" New topic
Author

Need help with DigestUtils SHA encryption

Andru Relod
Greenhorn

Joined: May 05, 2010
Posts: 2
Hi,
I am working on an application in java , which creates or edit the entry values in the LDAP server. When the user submits a "Reset PIN" request, the existing certificate with the UID is removed and a new PIN is generated. The pin is encrypted as DigestUtil.sha(dn+pin) [ An excryption done for string formed ]
dn= uid=123123,code=343434,ou=Clt,o=comp
pin = code

byte[] digest = DigestUtils.sha(dn + pin);

The encryption is done and the encrypted value is set as the pin attribute in the LDAP. A one way hashcode is generated when the attribute is set.

I have another application in perl where the user would download the new certificate by providing the PIN.
when the user submits for new certificate, the same kind of encrytion happens, it then compares to the hash code generated in the above applicaiton and replies back.

My issue is that, This is working fine for most of the dn values, But for some dn, the hash codes values generated for the same pin and dn are different from both the applications.
So the user is not able to download the certificate, saying incorrect password or authentication failed.

Please let me know how can I fix it ? is there any bug in DigestUtils encryption ?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need help with DigestUtils SHA encryption