Encrypt and Decrypt

B

Bhimashankar

Hi All,
Please help me to resolve the follwing the exception while Encrypt and
Decrypt the

javax.crypto.IllegalBlockSizeException: Input length must be multiple
of 8 when decrypting with padded cipher
at com.sun.crypto.provider.SunJCE_h.b(DashoA12275)
at com.sun.crypto.provider.SunJCE_h.b(DashoA12275)
 
A

Andreas Leitgeb

Bhimashankar said:
Hi All,
Please help me to resolve the follwing the exception while Encrypt and
Decrypt the
javax.crypto.IllegalBlockSizeException: Input length must be multiple
of 8 when decrypting with padded cipher
at com.sun.crypto.provider.SunJCE_h.b(DashoA12275)
at com.sun.crypto.provider.SunJCE_h.b(DashoA12275)

If *de*crypting fails, mentioning a wrongly-sized input, then
something went wrong with gathering the crypted data or passing
it to the decrypter.

If you read in the data from a file, perhaps some kind of
conversion was applied to it (e.g. CrLf->Lf) or some extra
encoding that was applied on the crpto-text (e.g. base64)
wasn't undone before decrypting.

An "sscce" (<http://sscce.org/>) would surely help *you* (by
allowing us to spot the error in your code). But even just
an excerpt of your code may suffice, if you happen to post
the right excerpt (the one that actually contains the bug).
 
A

Arne Vajhøj

rossum said:
Assuming that you are using a block cypher in CBC mode, then your
input plaintext will be padded to a whole number of blocks. This
means that your cyphertext will be longer than the original plaintext.
If you leave off the extra cyphertext then you will get the error you
are seeing.

I would say that the padding depends on padding not on mode.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top