Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

AES256 - java callout

Want help with conversion of below req(third party call) to java wrapper in apigee. I have the java code but having issues with the conversion to use in Apigee proxy.

1. Get the key that was returned from the “Get Authentication Token” call. This key is a URL-encoded base 64 string.
2. Derive the initialization vector (IV) to be used for encryption. Do this in the following way:
a. URL-decode the key.
b. Convert the URL-decoded key from a base 64 string to a byte array.
c. Apply the SHA256 algorithm to the decoded key to get a hash.
d. Remove every other value of the result. (The SHA256 hash is 32 bytes, but the IV vector must be 16 bytes, so remove every other byte so that the IV is 16 bytes.)
3. Create a string that is (with no spaces) username char(30) password
4. AES256-encrypt the string from Step 3, using:
• The decoded key from Step 2a as the AES key.
• The derived IV from Step 2d as the AES IV.

aes.txt

Thanks,

0 3 615
3 REPLIES 3