Login | ERROR: Wrong key or corrupt data in AAAPASSWORD table

Login | ERROR: Wrong key or corrupt data in AAAPASSWORD table

Wrong key or corrupt data issue: 

User is facing issues in local authentication or failing in AD user import or receiving an internal error while editing or deleting the user profile from UI. First, go to the logs and check if the below error traces are present. 
java.sql.SQLException: ERROR: Wrong key or corrupt data|
com.adventnet.persistence.DataAccessException: java.sql.SQLException: ERROR: Wrong key or corrupt data
at com.adventnet.persistence.internal.GetUtil.get(GetUtil.java:142)
at com.adventnet.persistence.internal.GetUtil.get(GetUtil.java:81)
at com.adventnet.persistence.DataAccess.get(DataAccess.java:1914)
at com.adventnet.persistence.DataAccess.get(DataAccess.java:1905)

1. If the error traces are present, run the following query, this query will return user logins that have SALT values of incorrect length in AAAPassword table. (versions greater than SDP 10.5 and AE 6.5)
select sdlogin.* from aaalogin sdlogin left join aaaaccount sdaccount on sdaccount.login_id = sdlogin.login_id left join aaaaccpassword sdaccpwd on sdaccpwd.account_id = sdaccount.account_id left join aaapassword sdpwd on sdpwd.password_id = sdaccpwd.password_id where length(sdpwd.salt) != 94 and length(sdpwd.salt) !=78;

2. If the query returns results, copy login Id from the query result and use it in the below update query. This update query will reset the password with correct SALT length. This query will reset the password as admin.
update AaaPassword set password='$2a$12$fZUC9IK8E/AwtCxMKnCfiu830qUyYB/JRhWpi2k1vgWLC6iLFAgxa', SALT=pgp_sym_encrypt('$2a$12$fZUC9IK8E/AwtCxMKnCfiu','SChar@123Mas!er','s2k-mode=1, cipher-algo=aes256'), algorithm='bcrypt' where password_id in (select ap.password_id from aaaaccpassword ap left join aaaaccount ac on ac.account_id=ap.account_id left join aaalogin al on al.login_id=ac.login_id where al.login_id in (<Login_ID>));

3. After executing the query, check whether the user is able to login and is getting successfully imported in AD import and able to edit the user profile from UI.

                  New to ADSelfService Plus?