javax.crypto.BadPaddingException: Given final block not properly paddedDES算法加密后,在解密时出现这个异常,说是要填充什么的
谁知道怎么填充啊Cipher cipher = Cipher.getInstance("DES");//这里怎么填充?????我试过很多个"DES/CBC/PKCS5Padding" "DES/ECB/PKCS5Padding"什么的,都还是错到底该怎么填充啊

谢谢

解决方案 »

  1.   

    速度
    来人救人啊
    加密一方和解密一方的
    Cipher cipher = Cipher.getInstance("DES");
    这句话到底怎么写知道的不吝赐教啊
    被这个搞死了
      

  2.   

    为什么我搜到的网上的代码都是
    Cipher cipher = Cipher.getInstance("DES"); 
    不用说明用什么填充可是我用这个就提示异常呢
    javax.crypto.BadPaddingException: Given final block not properly padded 我见到的网上所有的代码都不用说明填充方案啊

    郁闷
      

  3.   

    http://www.roboticfan.com/blog/user_2005/104/archives/2008/20088511023.shtml
      

  4.   

        // The length of Encryptionstring should be 8 bytes and not be   
        // a weak key   
        private String EncryptionString;   
      
        // The initialization vector should be 8 bytes   
        private final byte[] EncryptionIV = { 0x11, 0x22, 0x4F, 0x58, (byte) 0x88,   
                0x10, 0x40, 0x38, 0x28, 0x25, 0x79, 0x51, (byte) 0xCB, (byte) 0xDD,   
                0x55, 0x66, 0x77, 0x29, 0x74, (byte) 0x98, 0x30, 0x40, 0x36,   
                (byte) 0xE2 };   
        private final static String DES = "DES/CBC/PKCS5Padding";