Uploaded image for project: 'JGroups'
  1. JGroups
  2. JGRP-538

ENCRYPT protocol throwing IllegalBlockSizeException

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 2.5
    • 2.5
    • None
    • Hide

      Set loopback="false" in the transport (UDP, TCP, TCP_NIO)

      Show
      Set loopback="false" in the transport (UDP, TCP, TCP_NIO)

      I use NotificationBus channel and in the member joined method I call, bus.sendNotification(Node) - passing a custom Node object. Upon this I get the following error on the newly joined member,

      javax.crypto.IllegalBlockSizeException: Input length must be multiple of 8 when decrypting with padded cipher
      at com.sun.crypto.provider.SunJCE_f.b(DashoA13*..)
      at com.sun.crypto.provider.SunJCE_f.b(DashoA13*..)
      at com.sun.crypto.provider.DESCipher.engineDoFinal(DashoA13*..)
      at javax.crypto.Cipher.doFinal(DashoA13*..)
      at org.jgroups.protocols.ENCRYPT._decrypt(ENCRYPT.java:838)
      at org.jgroups.protocols.ENCRYPT.decryptMessage(ENCRYPT.java:831)
      at org.jgroups.protocols.ENCRYPT.handleUpMessage(ENCRYPT.java:672)
      at org.jgroups.protocols.ENCRYPT.up(ENCRYPT.java:533)

      I could reproduce the same problem using NotificationBusDemo.java in JGroups 2.5 CR1. Here is what I did,

      1) Generate a keystore using JGroups' KeyStoreGenerator (I also tried with JDK 1.6's keytool to generate secret key)
      2) Add the following line in the protocol stack of NotificationBusDemo.java in the main(),
      "ENCRYPT(key_store_name=jgroups.keystore;store_password=storePassed;alias=mykey):" +

      3) Add the following line in the memberJoined(..) method of NotificationBusDemo.java
      bus.sendNotification("Member Joined");

      4) Run 2 instances of NotificationBusDemo.java
      5) You'll get the following error message,

      > 3828 [WARN] ENCRYPT.up(): - exception occurred decrypting message
      javax.crypto.BadPaddingException: Given final block not properly padded
      at com.sun.crypto.provider.SunJCE_h.b(DashoA12275)
      at com.sun.crypto.provider.SunJCE_h.b(DashoA12275)

      I am running this on Windows using JGroups 2.5 CR1. The original thread for this issue is at,

      http://sourceforge.net/forum/forum.php?thread_id=1751571&forum_id=18795

              rhn-engineering-bban Bela Ban
              vivash vivek v (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: