Set Identity's Password - 400.1 Error

Hi,

I’m getting a 400.1 error when executing the REST API call for Set Identity’s password.

{
    "detailCode": "400.1 Bad request content",
    "trackingId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "messages": [
        {
            "locale": "en-US",
            "localeOrigin": "DEFAULT",
            "text": "The request was syntactically correct but its content is semantically invalid."
        },
        {
            "locale": "und",
            "localeOrigin": "REQUEST",
            "text": "The request was syntactically correct but its content is semantically invalid."
        }
    ],
    "causes": []
}

I have followed the steps listed:

  • Authorisation grant type of Client Credentials created from Admin > Global > Security Settings > API Management
  • Run Query Password info to get public key and other attributes required
  • RSA encryption of plaintext password using the following code referencing the sample provided by SailPoint:
    import javax.crypto.Cipher;
    import java.security.KeyFactory;
    import java.security.PublicKey;
    import java.security.spec.X509EncodedKeySpec;
    import java.util.Base64;
    
    public class RSAencrypt {
    
        public static void main(String[] args) throws Exception {
            // Enter Public key and Plaintext password
          	String pubKey = "";
            String plainText = "";
          	String cipherText = encrypt(pubKey, plainText);
            
            System.out.println(cipherText);
        }
    
        public static String encrypt(String publicKey, String toEncrypt) throws Exception {
            byte[] publicKeyBytes = Base64.getDecoder().decode(publicKey);
            byte[] encryptedBytes = encryptRsa(publicKeyBytes, toEncrypt.getBytes("UTF-8"));
            return Base64.getEncoder().encodeToString(encryptedBytes);
        }
          
        private static byte[] encryptRsa(byte[] publicKeyBytes, byte[] toEncryptBytes) throws Exception {
            PublicKey key = KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(publicKeyBytes));
            String transformation = "RSA/ECB/PKCS1Padding";
            Cipher cipher = Cipher.getInstance(transformation);
            cipher.init(1, key);
            return cipher.doFinal(toEncryptBytes);
        }
    
    }
    

Any insights on the issue would be greatly appreciated. Thank you!

Hi @ksbagade , 400 Error seems like the request body is invalid. Can you share the request body (masking sensitive data)

Thanks,

Sure.

This is my current request body:

{
    "identityId": "xxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "encryptedPassword": "Y3Cv4DqsgPOTeWcc8iOKGTELVSEmFo2sfIbNbuTKn+jsQ/INj4uON8LnsXTtB9y1IhzvetC8J6YPD309kaJWtwRWQoe/V3L7+UHBqmIxUxcVEPbYkTrvbRiaDSWTmzzebpykXDtejLF4NETZcTu6U6ki4PW8bkbVpIX7KzCXME6wAVPnEUZ4h+aVaTGxJzi4QySLPrTyX+QHP1pr6y5n/LuDxYI1XSNty/l5ozqmaVQw+ZAtVTLW1bRfxPV9HCHVL+NsFiPdqPKS4z5iCwnPl2CiuRlYY5sItBDjpjy5Rz8wsXpH83PnFZSTdS0HdVYTca0ebzlsrXTm+gF32nQndA==",
    "publicKeyId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "accountId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "sourceId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}

Hi @ksbagade,

I tried to set my identity’s password using the request body and RSA encryption sample code provided by Sailpoint, I am also getting the same error.

1 Like

I have identified the issue.

The source/connector that I had referenced does not support password change.

I used the IdentityNow source reference to test and now it returns a success code.

Thank you for all the replies!

2 Likes