Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've been asked to store hashed data in a LDAP server. Putting hashed passwords is easy but I'm not sure if LDAP allows to store data like email hashed or even encrypted.

Creating a LDIF file with a string "{MD5}contents" gives me no errors but I don't know how to retrieve this information once it's stored.

Any help?

share|improve this question
4  
Do you know how to retrieve any data from LDAP? Retrieving some field with hashed data is in no way different than retrieving any other kind of data. You read it, store it into a variable and use this variable however you need. –  SvW Sep 17 '12 at 13:00
add comment

1 Answer

up vote 4 down vote accepted

There is no magic here - you can store hashed data in any text field, you just need to hash the data before it goes to the server (most LDAP servers will helpfully hash passwords for you if they appear to be plaintext - that's not done for you with other text field types).

Similarly you can store encrypted data in any text field (provided it can be represented as text) - Just encrypt it before you put it in, and decrypt it after you take it out.


A Note on Nomenclature:

A one-way hash (what we do to passwords) is NOT the same as reversible encryption (what we do to data, for example with SSL).
With one-way hashes you (theoretically) can't ever get the data back again. If you store an MD5 hash of an email address you can verify that the user has provided the same email address later (because the hashes will match), but you can't tell them what the email address they gave you was based on the hash.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.