Search code examples
javaactive-directoryldap

Update unicodepwd in ActiveDirectory


I am trying to update the unicodePwd attribute in WindowsAD. I am using ldaps://server:636 to get the InitialContext created. The connection is just fine and I am able to search for a record. I can also update the givenName attribute, so I don't think there are any communication issues with the server.

I am doing the following encoding with my password: javax.xml.bind.DatatypeConverter.printBase64Binary(('"' + "T3stPassw0rd!" + '"').getBytes("UTF-16LE"));

When I try to update unicodePwd, I get the below error javax.naming.OperationNotSupportedException: [LDAP: error code 53 - 0000001F: SvcErr: DSID-031A120C, problem 5003 (WILL_NOT_PERFORM), data 0 ];

On looking up similar issues, I came to understand that this can happen if the connection is not ldaps (mine is ldaps, am able to search and update another attribute) or if the encoding is incorrect. I am using the encoding that was recommended, but cannot seem to get my code to work.

Appreciate any help on this.

Thanks !


Solution

  • We have an example that is known to work:

    Example - Active Directory Change Password JNDI