Skip to content Skip to sidebar Skip to footer

Aes Cbc Pkcs5padding Java To Ruby

I have troubles communicating encrypted data between java and ruby. Java => Java works fine Ruby => Ruby works fine Ruby => Java works fine Java => Ruby does not work (

Solution 1:

I suspect that it may be caused by padding scheme used. PKCS5 pads are of 64 bit (8 byte) block size, but AES-256-CBC uses 16 byte blocks. Therefore, try to use PKCS7 padding for Java side.

Solution 2:

The code above works just fine. The problem was in the encoding of the base64 sent through a post request.

Post a Comment for "Aes Cbc Pkcs5padding Java To Ruby"