0
votes

What is padding for PBEWITHSHA256AND128BITAES-CBC-BC (Bouncy Castle)

Sorry for tiny information, let me elaborate more background of the question. There have two systems. One is java (A) and another is PHP (B). Now we have one requirement to send string/text from system A to B. The content of string/text is encrypt by AES using jasypt. But I cannot decrypt it using mcrypt. I suspect it may due to A and B are using different parameters of AES so I try to find out how system A encrypt string/text. The information what I found are shown as below except padding,

jasypt ( java simple encryption )/PBEWITHSHA256AND128BITAES-CBC-BC

cipher: AES

length: 128 bit

encryption mode: CBC

JCE providers : Bouncy Castle

Salt : FixedStringSaltGenerator

Iterations: 2

Padding : ????

Thank in advance!

1
That is so vague. Can you elaborate?Buhake Sindi
bouncycastle.org/specifications.html for all of padding list accordinglybaodi

1 Answers

2
votes

That really depends on the actual Cipher instance you use to encrypt, thus your question doesn't make much sense (as @Buhake Sindi points out).

In any case, it would not be unusual to use PKCS#5, as in

Cipher.getInstance( "AES/CBC/PKCS5Padding" )

The point is: You decide the padding mode (the provider must implement it of course).

Have a look at the BouncyCastle Specifications - it should be clear from section 4.2 which padding modes can be used with which ciphers. Again, the default is PKCS#5/#7.

Cheers,