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

Error during ASYM_ENCRYPT-----exception occurred decrypting message javax.crypto.BadPaddingException: Given final block not properly padded

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Critical
    • Resolution: Done
    • Affects Version/s: 4.0.1
    • Fix Version/s: 4.0.16
    • Labels:
      None

      Description

      asym parameters:
      <ASYM_ENCRYPT encrypt_entire_message="true"
      sign_msgs="true"
      sym_keylength="128"
      sym_algorithm="AES/ECB/PKCS5Padding"
      asym_keylength="2048"
      asym_algorithm="RSA"
      change_key_on_leave="true"/>
      Throws the following error:
      2018-05-23T03:11:53,891 +2903450778 [jgroups--12467,-1491537117,1] ERROR org.jgroups.protocols.ASYM_ENCRYPT - 1: failed decrypting message from 2 (offset=0, length=1136, buf.length=1136): javax.crypto.BadPaddingException: Given final block not properly padded, headers are ASYM_ENCRYPT: [ENCRYPT version=16 bytes], TP: [cluster_name=-1491537117]
      2018-05-23T03:11:53,893 +2903450780 [jgroups--12467,-1491537117,1] TRACE org.jgroups.protocols.TCP_NIO2 - 1: received message batch of 1 messages from 2
      2018-05-23T03:11:53,895 +2903450782 [jgroups--12467,-1491537117,1] DEBUG org.jgroups.protocols.ASYM_ENCRYPT - 1: received secret key from keyserver 2
      2018-05-23T03:11:53,895 +2903450782 [jgroups--12467,-1491537117,1] DEBUG org.jgroups.protocols.ASYM_ENCRYPT - 1: created 8 symmetric ciphers with secret key (16 bytes)
      2018-05-23T03:11:54,369 +2903451256 [jgroups--12467,-1491537117,1] TRACE org.jgroups.protocols.TCP_NIO2 - 1: received [dst:***
      2018-05-23T03:11:54,369 +2903451256 [jgroups--12467,-1491537117,1] WARN org.jgroups.protocols.ASYM_ENCRYPT - 1: exception occurred decrypting message
      javax.crypto.BadPaddingException: Given final block not properly padded
      at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:991) ~[sunjce_provider.jar:1.8.0_162]
      at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:847) ~[sunjce_provider.jar:1.8.0_162]
      at com.sun.crypto.provider.AESCipher.engineDoFinal(AESCipher.java:446) ~[sunjce_provider.jar:1.8.0_162]
      at javax.crypto.Cipher.doFinal(Cipher.java:2222) ~[?:1.8.0_171]
      at org.jgroups.protocols.Encrypt.code(Encrypt.java:365) ~[jgroups-4.0.1.Final.jar:4.0.1.Final]
      at org.jgroups.protocols.Encrypt.decryptChecksum(Encrypt.java:387) ~[jgroups-4.0.1.Final.jar:4.0.1.Final]
      at org.jgroups.protocols.Encrypt._decrypt(Encrypt.java:299) ~[jgroups-4.0.1.Final.jar:4.0.1.Final]
      at org.jgroups.protocols.Encrypt.decryptMessage(Encrypt.java:283) ~[jgroups-4.0.1.Final.jar:4.0.1.Final]
      at org.jgroups.protocols.Encrypt.handleEncryptedMessage(Encrypt.java:242) ~[jgroups-4.0.1.Final.jar:4.0.1.Final]
      at org.jgroups.protocols.Encrypt.handleUpMessage(Encrypt.java:229) ~[jgroups-4.0.1.Final.jar:4.0.1.Final]
      at org.jgroups.protocols.Encrypt.up(Encrypt.java:155) [jgroups-4.0.1.Final.jar:4.0.1.Final]
      at org.jgroups.protocols.ASYM_ENCRYPT.up(ASYM_ENCRYPT.java:143) [jgroups-4.0.1.Final.jar:4.0.1.Final]
      at org.jgroups.protocols.VERIFY_SUSPECT.up(VERIFY_SUSPECT.java:129) [jgroups-4.0.1.Final.jar:4.0.1.Final]
      at org.jgroups.protocols.FD_ALL.up(FD_ALL.java:197) [jgroups-4.0.1.Final.jar:4.0.1.Final]
      at org.jgroups.protocols.FD_SOCK.up(FD_SOCK.java:252) [jgroups-4.0.1.Final.jar:4.0.1.Final]
      at org.jgroups.protocols.MERGE3.up(MERGE3.java:277) [jgroups-4.0.1.Final.jar:4.0.1.Final]
      at org.jgroups.protocols.Discovery.up(Discovery.java:262) [jgroups-4.0.1.Final.jar:4.0.1.Final]
      at org.jgroups.protocols.TP.passMessageUp(TP.java:1203) [jgroups-4.0.1.Final.jar:4.0.1.Final]
      at org.jgroups.util.SubmitToThreadPool$SingleMessageHandler.run(SubmitToThreadPool.java:87) [jgroups-4.0.1.Final.jar:4.0.1.Final]
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_162]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_162]
      at java.lang.Thread.run(Thread.java:748) [?:1.8.0_162]

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  pferraro Paul Ferraro
                  Reporter:
                  gejiang George Jiang
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: