mcrypt_encrypt in Apigee

anuprai
Participant IV

Hi,

We have a legacy API which expects a key in payload. This key can be generated using below php code -

<?php
$stringToEncode="SampleKeyStringToEncode";
$stringToEncode=str_pad(some Logic to calculate the length of padding and character to pad);
	
    echo (base64_encode(
        mcrypt_encrypt(
                    MCRYPT_RIJNDAEL_256,
                    "<AESkey>",
                    $StringToEncode,
                    MCRYPT_MODE_CBC,
	            "<AESkey>"
                )
            ));

How can we implement the same in Apigee?

Solved Solved
0 3 170
1 ACCEPTED SOLUTION

You'd have to build a Java callout to perform that calculation.

There is a helpful hint here on this stackoverflow post.

You can start with the AES encryption callout , and modify it to perform mcrypt.

AES is not the same as MCRYPT Rijndael, but ... they're related and pretty close.

View solution in original post

3 REPLIES 3

You'd have to build a Java callout to perform that calculation.

There is a helpful hint here on this stackoverflow post.

You can start with the AES encryption callout , and modify it to perform mcrypt.

AES is not the same as MCRYPT Rijndael, but ... they're related and pretty close.

Thanks @Dino ,I am able to do this using java callout.

GREAT; Glad to hear it.