分享java帶來(lái)的快樂

          我喜歡java新東西

          AES加密是key的字節(jié)數(shù)

          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 強(qiáng)強(qiáng) 閱讀(8626) 評(píng)論(0)  編輯  收藏 所屬分類: Java

          主站蜘蛛池模板: 临湘市| 游戏| 绥江县| 南阳市| 洪泽县| 清水县| 高台县| 三亚市| 大庆市| 中江县| 安龙县| 中宁县| 财经| 吉林省| 永城市| 合阳县| 斗六市| 怀来县| 盘山县| 连江县| 沅江市| 封开县| 拉萨市| 呼图壁县| 行唐县| 镇坪县| 衡阳市| 钟祥市| 吕梁市| 安新县| 柘城县| 长春市| 德令哈市| 湖州市| 澜沧| 汤原县| 南漳县| 海口市| 阿克| 车致| 同心县|