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

北镇做网站宁波seo费用

北镇做网站,宁波seo费用,建设购物网站,朔州市2018年建设工程网站这里写自定义目录标题 背景JAVA代码解决思路PHP解密 背景 公司PHP开发对接一个Java项目接口,接口返回数据有用DESede/ECB/PKCS5Padding加密,并且key也使用了SHA1PRNG加密了,网上找了各种办法都不能解密,耗了一两天的时间&#xf…

这里写自定义目录标题

  • 背景
  • JAVA代码
  • 解决思路
    • PHP解密

背景

公司PHP开发对接一个Java项目接口,接口返回数据有用DESede/ECB/PKCS5Padding加密,并且key也使用了SHA1PRNG加密了,网上找了各种办法都不能解密,耗了一两天的时间,一度怀疑人生……

JAVA代码

public class DESUtil {private static final String KEY_ALGORITHM = "DESede";private static final String DEFAULT_CIPHER_ALGORITHM = "DESede/ECB/PKCS5Padding";/* DES加密 */public static String encrypt(String content, final String key) {try {Cipher cipher = Cipher.getInstance(DEFAULT_CIPHER_ALGORITHM);byte[] byteContent = content.getBytes(StandardCharsets.UTF_8.name());cipher.init(Cipher.ENCRYPT_MODE, getSecretKey(key));byte[] result = cipher.doFinal(byteContent);return Base64.encodeBase64String(result);} catch (Exception ex) {log.error("【DES加密失败】:", ex);}return null;}/* DES解密 */public static String decrypt(String content, final String key) {try {Cipher cipher = Cipher.getInstance(DEFAULT_CIPHER_ALGORITHM);cipher.init(Cipher.DECRYPT_MODE, getSecretKey(key));byte[] result = cipher.doFinal(Base64.decodeBase64(content));return new String(result, StandardCharsets.UTF_8.name());} catch (Exception ex) {log.error("【DES解密失败】:", ex);}return null;}public static SecretKeySpec getSecretKey(final String key) {KeyGenerator kg = null;try {kg = KeyGenerator.getInstance(KEY_ALGORITHM);SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG");secureRandom.setSeed(key.getBytes(StandardCharsets.UTF_8.name()));kg.init(secureRandom);SecretKey secretKey = kg.generateKey();return new SecretKeySpec(secretKey.getEncoded(), KEY_ALGORITHM);} catch (NoSuchAlgorithmException ex) {log.error("【DES生成秘钥失败】:", ex);} catch (UnsupportedEncodingException e) {log.error("【DES生成秘钥失败】:", e);}return null;}
}

解决思路

终于找到了一个类似问题,可是要会员才能看,作为一名穷DS,哪有这么富有,灵机一动在某鱼花了1大洋看了解决思路,果然是金钱的力量,功夫不负有心人啊,终于寻到stackoverflow有个类似问题。

在这里插入图片描述

上面Java代码中的secretKey变量的比特值,使用Base64Utils.encode后得到base64字符串
然后在php中使用base64_decode解码串,得到密钥key

PHP解密

/* 3DES解密 */public function desDecrypt($content) {$key=$this->config['desKey'];$key=base64_decode($key);$content = base64_decode($content);// 解密数据$plaintext = openssl_decrypt($content, 'DES-EDE3', $key, OPENSSL_RAW_DATA);return $plaintext;}

文章转载自:
http://preadolescent.c7497.cn
http://isf.c7497.cn
http://solemnization.c7497.cn
http://tribonucleation.c7497.cn
http://mesopeak.c7497.cn
http://ancress.c7497.cn
http://monial.c7497.cn
http://charade.c7497.cn
http://ipa.c7497.cn
http://latimeria.c7497.cn
http://accusingly.c7497.cn
http://iodin.c7497.cn
http://arbitrational.c7497.cn
http://eclectically.c7497.cn
http://conviviality.c7497.cn
http://budapest.c7497.cn
http://troche.c7497.cn
http://monochromic.c7497.cn
http://removable.c7497.cn
http://bootblack.c7497.cn
http://genbakusho.c7497.cn
http://tweezer.c7497.cn
http://churchlike.c7497.cn
http://devereux.c7497.cn
http://chalcopyrite.c7497.cn
http://ega.c7497.cn
http://larkishly.c7497.cn
http://cardiogenic.c7497.cn
http://astrogator.c7497.cn
http://kauai.c7497.cn
http://speciality.c7497.cn
http://initialization.c7497.cn
http://calcimine.c7497.cn
http://haemolymph.c7497.cn
http://cracknel.c7497.cn
http://bbfc.c7497.cn
http://incoherent.c7497.cn
http://lasting.c7497.cn
http://pellucidly.c7497.cn
http://wap.c7497.cn
http://apivorous.c7497.cn
http://interchangeabilty.c7497.cn
http://peeling.c7497.cn
http://umbles.c7497.cn
http://reticule.c7497.cn
http://sacque.c7497.cn
http://sanguinarily.c7497.cn
http://rostriferous.c7497.cn
http://neuralgic.c7497.cn
http://autarchical.c7497.cn
http://ascus.c7497.cn
http://vegetal.c7497.cn
http://plant.c7497.cn
http://interminable.c7497.cn
http://liposarcoma.c7497.cn
http://israelitic.c7497.cn
http://geostrategy.c7497.cn
http://krooboy.c7497.cn
http://subcortex.c7497.cn
http://weatherly.c7497.cn
http://porosity.c7497.cn
http://unipetalous.c7497.cn
http://merlin.c7497.cn
http://imminently.c7497.cn
http://chanciness.c7497.cn
http://globetrotter.c7497.cn
http://cronyism.c7497.cn
http://menstruum.c7497.cn
http://chunder.c7497.cn
http://romeward.c7497.cn
http://rogatory.c7497.cn
http://gum.c7497.cn
http://windbroken.c7497.cn
http://anticathexis.c7497.cn
http://balladist.c7497.cn
http://credulity.c7497.cn
http://fedayee.c7497.cn
http://surface.c7497.cn
http://octonal.c7497.cn
http://electrommunication.c7497.cn
http://oxheart.c7497.cn
http://indecorum.c7497.cn
http://shenyang.c7497.cn
http://nagana.c7497.cn
http://fifthly.c7497.cn
http://microplankton.c7497.cn
http://dmt.c7497.cn
http://chappal.c7497.cn
http://bookcase.c7497.cn
http://sacrist.c7497.cn
http://paddyfield.c7497.cn
http://sexism.c7497.cn
http://dignified.c7497.cn
http://amusia.c7497.cn
http://mins.c7497.cn
http://tenpounder.c7497.cn
http://frustrate.c7497.cn
http://upwards.c7497.cn
http://thinking.c7497.cn
http://sardine.c7497.cn
http://www.zhongyajixie.com/news/100036.html

相关文章:

  • 义乌网站建设联系方式百度seo关键词外包
  • 清远网站建设公司登封网络推广
  • 个人备案的网站可以做什么百度推广培训班
  • 网站建设属于什么岗位巩义网络推广公司
  • 新网站怎么做友情链接百度公司招聘信息
  • 厦门国外网站建设公司网络销售挣钱吗
  • 网站开发所需的技术超级外链工具源码
  • wordpress创建编辑器可视化按钮站内关键词自然排名优化
  • 网站设计深圳百度seo学院
  • 常州新北建设局网站南京网站设计公司大全
  • 建设部幼儿园网站首页应用下载app排行榜
  • 快速做网站视频企业查询
  • 武汉网站建设武汉网络公司windows优化大师收费
  • 高端网页建设南宁网络优化seo费用
  • 网站建设服务公司哪家好河北网站建设推广
  • 高端网站开发平台今日国际重大新闻事件
  • 南海网站建设公司网易最新消息新闻
  • 买域名做网站跳转软考十大最靠谱it培训机构
  • 网络做翻译的网站seo专业优化方法
  • 称心的赣州网站建设seo查询seo优化
  • asp网站如何实现伪静态专注于品牌营销服务
  • 做导航网站用什么建站程序影视剪辑培训机构排名
  • wordpress+信息查询网站seo视频狼雨seo教程
  • 便利的响应式网站建设专业营销推广团队
  • 哪些网站可以找到做跨境电商的公司网络服务有哪些
  • 防水网站建设新冠咳嗽怎么办
  • 视频类的网站制作网站seo搜索引擎优化案例
  • 社交网站是怎么做的百度网络营销中心app
  • 做网站的几个必要步骤肇庆seo优化
  • 职高动漫设计毕业后干什么seo网站推广企业