Encrypt and Decrypt

Discussion in 'Java' started by Bhimashankar, Aug 17, 2009.

  1. Bhimashankar

    Bhimashankar Guest

    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)
    Bhimashankar, Aug 17, 2009
    #1
    1. Advertising

  2. Bhimashankar <> wrote:
    > 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).
    Andreas Leitgeb, Aug 17, 2009
    #2
    1. Advertising

  3. Bhimashankar

    Roedy Green Guest

    On Mon, 17 Aug 2009 05:36:29 -0700 (PDT), Bhimashankar
    <> wrote, quoted or indirectly quoted someone who
    said :

    >javax.crypto.IllegalBlockSizeException: Input length must be multiple
    >of 8 when decrypting with padded cipher


    see:
    http://mindprod.com/jgloss/runerrormessages.html#ILLEGALBLOCKSIZEEXCEPTION
    --
    Roedy Green Canadian Mind Products
    http://mindprod.com

    "If you think it’s expensive to hire a professional to do the job, wait until you hire an amateur."
    ~ Red Adair (born: 1915-06-18 died: 2004-08-07 at age: 89)
    Roedy Green, Aug 17, 2009
    #3
  4. Bhimashankar

    Arne Vajhøj Guest

    rossum wrote:
    > On Mon, 17 Aug 2009 05:36:29 -0700 (PDT), Bhimashankar
    > <> wrote:
    >> 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)

    > 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
    Arne Vajhøj, Aug 23, 2009
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?TWlrZQ==?=
    Replies:
    0
    Views:
    935
    =?Utf-8?B?TWlrZQ==?=
    Aug 31, 2005
  2. Randall Parker
    Replies:
    0
    Views:
    1,621
    Randall Parker
    Dec 4, 2005
  3. Replies:
    2
    Views:
    14,508
    =?iso-8859-1?B?QmVub+50?=
    Jun 23, 2005
  4. sweety
    Replies:
    9
    Views:
    1,005
    Richard Heathfield
    Feb 7, 2006
  5. Replies:
    1
    Views:
    420
    Daniel Martin
    Jun 16, 2007
Loading...

Share This Page