• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Himai Minh

Need help with DigestUtils SHA encryption

Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ?
brevity is the soul of wit - shakepeare. Tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
    Bookmark Topic Watch Topic
  • New Topic