当前位置: 首页 > news >正文

中介网站模板专用车网站建设多少钱

中介网站模板,专用车网站建设多少钱,免费做网站的,嘉兴门户网站建设我更改了一些代码行,以保证大文件的加密.现在我遇到了问题,解密不起作用.我收到以下错误消息/异常#xff1a;Error encrypting/decrypting fileat Algorithmus.Encryptor.doCrypto(Encryptor.java:71)at Algorithmus.Encryptor.decrypt(Encryptor.java:39)at GUI.MainWindow$…我更改了一些代码行,以保证大文件的加密.现在我遇到了问题,解密不起作用.我收到以下错误消息/异常Error encrypting/decrypting fileat Algorithmus.Encryptor.doCrypto(Encryptor.java:71)at Algorithmus.Encryptor.decrypt(Encryptor.java:39)at GUI.MainWindow$encryptThread.run(MainWindow.java:838)Caused by: javax.crypto.BadPaddingException: Given final block not properly paddedat com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:966)at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:824)at com.sun.crypto.provider.AESCipher.engineDoFinal(AESCipher.java:436)at javax.crypto.Cipher.doFinal(Cipher.java:2165)at Algorithmus.Encryptor.doCrypto(Encryptor.java:60)... 2 more我试图将Transoformation参数更改为AES / CBC / PKCS5Padding,但这没有任何效果.有谁知道,如何优化给定的代码private static final String ALGORITHM AES;private static final String TRANSFORMATION AES;public static void encrypt(String key, File inputFile, File outputFile)throws ExtendedException {doCrypto(Cipher.ENCRYPT_MODE, key, inputFile, outputFile);}public static void decrypt(String key, File inputFile, File outputFile)throws ExtendedException {doCrypto(Cipher.DECRYPT_MODE, key, inputFile, outputFile);}private static void doCrypto(int cipherMode, String key, File inputFile,File outputFile) throws ExtendedException {try {Key secretKey new SecretKeySpec(key.getBytes(), ALGORITHM);Cipher cipher Cipher.getInstance(TRANSFORMATION);cipher.init(cipherMode, secretKey);FileInputStream inputStream new FileInputStream(inputFile);CipherOutputStream out new CipherOutputStream(new FileOutputStream(outputFile), cipher);byte[] buffer new byte[8192];byte[] outputBytes null;FileOutputStream outputStream new FileOutputStream(outputFile);int count;while ((count inputStream.read(buffer)) 0){out.write(buffer, 0, count);outputBytes cipher.doFinal(buffer);}inputStream.close();outputStream.close();} catch (NoSuchPaddingException | NoSuchAlgorithmException| InvalidKeyException | BadPaddingException| IllegalBlockSizeException | IOException ex) {throw new ExtendedException(Error encrypting/decrypting file, ex);}}解决方法:只需使用CipherOutputStream即可.不要调用cipher.doFinal(缓冲区),也不要忘记关闭输出流.FileInputStream inputStream new FileInputStream(inputFile);FileOutputStream fileout new FileOutputStream(outputFile);CipherOutputStream out new CipherOutputStream(fileout , cipher);try {byte[] buffer new byte[8192];int count;while ((count inputStream.read(buffer)) 0) {out.write(buffer, 0, count);}} finally {out.close();inputStream.close();}CipherOutputStream为您管理密码.它将在关闭流并刷新内部缓冲区时调用doFinal.标签java,padding,cryptography,encryption,aes来源 https://codeday.me/bug/20190628/1311548.html
http://wiki.neutronadmin.com/news/41912/

相关文章:

  • 即墨网站制作wordpress后台总是404
  • 湘潭网站开发公司建设网络强国要有什么
  • wordpress 相册模式seo搜索优化排名
  • c 网站开发需要学什么软件网站建设情况
  • 做网站百科国外设计导航网站大全
  • 湖北手机网站建设进入公众号会有记录吗
  • 网站包503错误电子商务网站建设规划书范文
  • 如何分析网站用户体验织梦网站模板响应式
  • 高明区住房和城乡建设局网站免费订单管理app
  • 网站建设团队架构海尔的网络营销模式
  • 建公司网站要多少钱深圳网站制作公司流程图
  • 西安网站建设网络推广wordpress网页版入口看文
  • 太原广告公司网站建设wordpress让超链接不显示蓝字
  • 企业营销网站建设规划wordpress调用标签云
  • 汽车门户网站源码国外开源商城系统
  • 淮安市建设工程安全监督站网站泉州网站建站公司
  • 旅行社营业网点可以做网站吗lol中国战队
  • 2015网站备案没下来人力资源公司注册条件
  • 兰州财经大学网站开发与维护邹城网站建设哪家好
  • 网站建设软著网站demo制作
  • 如何给网站做关键字wordpress的母版页
  • 购物网站开发的背景与意义免费自助建站网站一览自助建站平台
  • 服装网上商城网站建设报告20最快的加载wordpress主题
  • 专业婚纱摄影网站制作哪些购物网站有做拼团活动
  • 网站源代码怎么放入 dede网站后台wordpress标签函数
  • 怎样网站制作设计浙江省网站建设与管理试卷
  • 做摄影网站的目的谷歌广告优化师
  • 给设计网站做图是商用吗中文域名交易网站
  • 自己做的网站怎么接数据库浙江省住房和城乡建设局网站首页
  • 青岛市医疗保险网站网站制作建设公司