Why am I getting 'BadPaddingException' when decrypting?

后端 未结 2 935
清酒与你
清酒与你 2020-12-30 18:21

Here are my encryption settings:

public static String encryptionAlgorithm = \"AES\";
public static short encryptionBitCount = 256;
public static int encrypti         


        
2条回答
  •  孤城傲影
    2020-12-30 18:50

    From my initial comment:

    A typical scenario is one where the key is different from the one used at the other side. This is the most probable cause, but you might also want to check the way you handle streams, because you really lack .close() and possibly .flush() statements. You also assume that you always can read all the data into the buffer, which may not be the case.

    The key was indeed calculated incorrectly.

提交回复
热议问题