Posted By:
Scott_Ashmore
Posted On:
Tuesday, March 19, 2002 08:23 AM
Hi, I've made a small LDAP client to retrieve user data from an LDAP server which then uses the data for authentication purposes elsewhere. All of the LDAP attributes except for one returns in plain text. The required attribute that does not convert to plain text is the userpassword. Please note that none of the data is encrypted on the LDAP server. Here is an excerpt of my code (which results in a seemingly encrypted password - i.e. the value of the password variable is '[B@4f2c80' which of course is not the password): DirContext ctx = new InitialDirContext(env); attrs = ctx.getAttributes(dn); String password = attrs.get("userpassword").
More>>
Hi,
I've made a small LDAP client to retrieve user data from an LDAP server which then uses the data for authentication purposes elsewhere. All of the LDAP attributes except for one returns in plain text. The required attribute that does not convert to plain text is the userpassword. Please note that none of the data is encrypted on the LDAP server.
Here is an excerpt of my code (which results in a seemingly encrypted password - i.e. the value of the password variable is '[B@4f2c80' which of course is not the password):
DirContext ctx = new InitialDirContext(env);
attrs = ctx.getAttributes(dn);
String password = attrs.get("userpassword").get().toString();
According to LDAP documentation, the userpassword is in octetStringSyntax. The LDAP documentation also states that values of octetStringSyntax Strings are the string values themselves. To me, that seems to imply that it should be in plain text but that is not the case. Casting the attribute as String instead of using toString() results in a "java.lang.ClassCastException: [B". Perhaps the '[B' is supposed to be of some significance?
If anyone knows of a solution to this problem, or can give me some insight as how to interpret octetStringSyntax or what specific class it needs to be casted as I'd greatly appreciate it.
Thanks in advance,
Scott
<<Less