Hi
Does anyone successfully find the correct way to adapt the REST API scripts according to the new API v2 CA Certificate standards: adding the new parameter "encodedDataFormat": "v2".
I tried to prefix the payload used to generate the encodedData and encodedSignedData
by using the timestamp (also UTC), considering 8+92 or 8+100 bytes, but I did not find the right combination.
https://help.anaplan.com/authentication-api-security-improvements-465aed3f-efcb-4971-af83-1d860a106fde
Every time I use authentication without "encodedDataFormat": "v2" parameter in the "body", everything works fine.
When I add the v2 parameter, it does not work :(.
Below are some parts of the Python Code I used. Any ideas what does not work with v2?
timestamp_ms = int(datetime.now(timezone.utc).timestamp() * 1000)
timestamp_bytes = timestamp_ms.to_bytes(8, byteorder="little")
random_bytes = os.urandom(92)
payload_bytes = timestamp_bytes + random_bytes #100 bytes
signed_bytes = private_key.sign(
payload_bytes,
padding.PKCS1v15(),
hashes.SHA512()
)
encodedData = base64.b64encode(payload_bytes).decode("utf-8")
encodedSignedData = base64.b64encode(signed_bytes).decode("utf-8")
Thanks,
Alex