分享java帶來的快樂

          我喜歡java新東西

          AES加密是key的字節數

          Exception in thread "main" java.security.InvalidKeyException: Invalid AES key length: 6 bytes
          at com.sun.crypto.provider.AESCipher.engineGetKeySize(DashoA13*..)
          at javax.crypto.Cipher.b(DashoA13*..)
          at javax.crypto.Cipher.a(DashoA13*..)
          at javax.crypto.Cipher.a(DashoA13*..)
          at javax.crypto.Cipher.a(DashoA13*..)
          at javax.crypto.Cipher.init(DashoA13*..)
          at javax.crypto.Cipher.init(DashoA13*..)
          at AES.main(AES.java:48)

          The problem is surely with the length of the key, I have tried different length but I am getting the same, could you please tell me the length of the key please, I am new to cryptography, I have made some research but still can't figure out the problem. Thanks a lot for your answers.

           
          AES supports 128, 192 and 256 bit keys, so the number of bytes needs to be 16, 24, or 32. Note that the latter two may not be available in all circumstances (as the comment in the "kgen.init(128)" line mentions). 

          posted on 2011-07-26 21:56 強強 閱讀(8626) 評論(0)  編輯  收藏 所屬分類: Java

          主站蜘蛛池模板: 犍为县| 宁海县| 柳林县| 玉山县| 元氏县| 鹰潭市| 呼和浩特市| 安徽省| 肃北| 葫芦岛市| 中西区| 鸡西市| 汶上县| 洛浦县| 连江县| 胶南市| 临漳县| 固安县| 延长县| 临颍县| 文成县| 汉中市| 石屏县| 广州市| 南昌市| 科尔| 洛川县| 镇江市| 遵义市| 扶沟县| 秀山| 和田县| 米泉市| 水城县| 扶沟县| 昂仁县| 买车| 罗源县| 盐亭县| 凤翔县| 开化县|