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!