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

wordpress做下载型网站seo网站关键词优化费用

wordpress做下载型网站,seo网站关键词优化费用,网络营销与推广方案,车陂手机网站建设电话前言 在接口测试中,我们经常需要对请求进行签名,以保证数据的安全性。而SHA256withRSA是一种较为常见的签名算法,它可以使用私钥对数据进行签名,使用公钥进行验签。 但是,实现该算法签名可能会涉及到一些繁琐的操作&…

前言

在接口测试中,我们经常需要对请求进行签名,以保证数据的安全性。而SHA256withRSA是一种较为常见的签名算法,它可以使用私钥对数据进行签名,使用公钥进行验签。

但是,实现该算法签名可能会涉及到一些繁琐的操作,给我们的工作带来不小的困扰。

今天,我要向大家介绍一个神器——Postman,它可以轻松完成SHA256withRSA签名的实现,让您的API请求得到更加完善的保护。

接下来,我将简单介绍如何使用Postman实现SHA256withRSA签名,并且分享一些注意事项和技巧,希望能让大家轻松掌握这个技能。

获取pmlib

引入依赖bundle.js,有以下两种方式:
  1. 从github下载postman collection ,并导入进你的集合里
    官方使用介绍

 

  1. 将所需js所需js所需js全部复制保存成一个全局变量如:pmlib_code
    在这里插入图片描述
  2. 把自己的私钥设置成环境变量如:pri_key
    在这里插入图片描述

使用Pre-request Script对请求进行加签(具体加签字段请看自己项目) 

// 使用eval执行js
eval(pm.globals.get('pmlib_code'))// 生成rfctime
let date = new Date()
let y = date.getFullYear()
let m = date.getMonth()+1<10?'0'+(date.getMonth()+1):(date.getMonth()+1)
let d = date.getDate()<10?'0'+date.getDate():date.getDate()
let hh = date.getHours()<10?'0'+date.getHours():date.getHours();            
let mm = date.getMinutes()<10?'0'+date.getMinutes():date.getMinutes()
let ss = date.getSeconds()<10?'0'+date.getSeconds():date.getSeconds()
this.rfc_time = y +'-' + m + '-' + d + ' ' + hh + ':' + mm + ':' + ss
this.rfc_time = this.rfc_time.replace(/\s+/g, 'T')+'+08:00'
pm.variables.set('rfctime',this.rfc_time)
// console.log(pm.variables.get('rfctime'))const privkey = pm.environment.get('pri_key').replace(/\\n/g, "\n")// 随机字符串
const uuid = pm.variables.replaceIn('{{$randomUUID}}')
pm.variables.set('nonce_str', uuid)const requestBodyRaw = pm.variables.replaceIn(pm.request.body == undefined ? '' : pm.request.body.raw)const now = pm.variables.replaceIn('{{$timestamp}}')
pm.variables.set('req_time', now)
// 具体加密字段拼接请依据项目情况案例是:method+\n+url+\n+timestamp+\n+nonce_str+\n+body
var dataToSign = pm.request.method + "\n" +pm.request.url.getPathWithQuery() + "\n" +now + "\n" +uuid + "\n" +requestBodyRawconsole.log(dataToSign)const sha256withrsa = new pmlib.rs.KJUR.crypto.Signature({"alg": "SHA256withRSA"});
sha256withrsa.init(privkey);sha256withrsa.updateString(dataToSign);const sign = pmlib.rs.hextob64(sha256withrsa.sign());// console.log(sign);
pm.variables.set('sign', sign)
// 添加请求头
pm.request.headers.add({key:"Authorization",value:"SHA256-RSA nonce_str={{nonce_str}},timestamp={{req_time}},signature={{sign}}"
});

 使用Pre-request Script对请求进行加签(具体加签字段请看自己项目)

// 使用eval执行js
eval(pm.globals.get('pmlib_code'))// 生成rfctime
let date = new Date()
let y = date.getFullYear()
let m = date.getMonth()+1<10?'0'+(date.getMonth()+1):(date.getMonth()+1)
let d = date.getDate()<10?'0'+date.getDate():date.getDate()
let hh = date.getHours()<10?'0'+date.getHours():date.getHours();            
let mm = date.getMinutes()<10?'0'+date.getMinutes():date.getMinutes()
let ss = date.getSeconds()<10?'0'+date.getSeconds():date.getSeconds()
this.rfc_time = y +'-' + m + '-' + d + ' ' + hh + ':' + mm + ':' + ss
this.rfc_time = this.rfc_time.replace(/\s+/g, 'T')+'+08:00'
pm.variables.set('rfctime',this.rfc_time)
// console.log(pm.variables.get('rfctime'))const privkey = pm.environment.get('pri_key').replace(/\\n/g, "\n")// 随机字符串
const uuid = pm.variables.replaceIn('{{$randomUUID}}')
pm.variables.set('nonce_str', uuid)const requestBodyRaw = pm.variables.replaceIn(pm.request.body == undefined ? '' : pm.request.body.raw)const now = pm.variables.replaceIn('{{$timestamp}}')
pm.variables.set('req_time', now)
// 具体加密字段拼接请依据项目情况案例是:method+\n+url+\n+timestamp+\n+nonce_str+\n+body
var dataToSign = pm.request.method + "\n" +pm.request.url.getPathWithQuery() + "\n" +now + "\n" +uuid + "\n" +requestBodyRawconsole.log(dataToSign)const sha256withrsa = new pmlib.rs.KJUR.crypto.Signature({"alg": "SHA256withRSA"});
sha256withrsa.init(privkey);sha256withrsa.updateString(dataToSign);const sign = pmlib.rs.hextob64(sha256withrsa.sign());// console.log(sign);
pm.variables.set('sign', sign)
// 添加请求头
pm.request.headers.add({key:"Authorization",value:"SHA256-RSA nonce_str={{nonce_str}},timestamp={{req_time}},signature={{sign}}"
});

至此SHA256withRSA签名已完成
在这里插入图片描述

 感谢每一个认真阅读我文章的人,礼尚往来总是要有的,虽然不是什么很值钱的东西,如果你用得到的话可以直接拿走:

 

这些资料,对于【软件测试】的朋友来说应该是最全面最完整的备战仓库,这个仓库也陪伴上万个测试工程师们走过最艰难的路程,希望也能帮助到你!有需要的小伙伴可以点击下方小卡片领取 

 


文章转载自:
http://pastorage.c7491.cn
http://anhysteretic.c7491.cn
http://maymyo.c7491.cn
http://radiophosphorus.c7491.cn
http://unindicted.c7491.cn
http://shower.c7491.cn
http://extralinguistic.c7491.cn
http://medico.c7491.cn
http://perpetuate.c7491.cn
http://separate.c7491.cn
http://ln.c7491.cn
http://mootah.c7491.cn
http://odalisque.c7491.cn
http://acciaccatura.c7491.cn
http://broking.c7491.cn
http://sparely.c7491.cn
http://drinkie.c7491.cn
http://intromission.c7491.cn
http://potentiometer.c7491.cn
http://girsh.c7491.cn
http://aacs.c7491.cn
http://kirsch.c7491.cn
http://gibbose.c7491.cn
http://runless.c7491.cn
http://japura.c7491.cn
http://thirstily.c7491.cn
http://materiality.c7491.cn
http://bbbc.c7491.cn
http://repossession.c7491.cn
http://colitis.c7491.cn
http://sardar.c7491.cn
http://proverbially.c7491.cn
http://lpt.c7491.cn
http://benfactress.c7491.cn
http://backstroke.c7491.cn
http://hacendado.c7491.cn
http://snuffling.c7491.cn
http://explainable.c7491.cn
http://hedgy.c7491.cn
http://zirconate.c7491.cn
http://cholerine.c7491.cn
http://gorilla.c7491.cn
http://insouciant.c7491.cn
http://cephalopodous.c7491.cn
http://ebon.c7491.cn
http://collop.c7491.cn
http://diphosgene.c7491.cn
http://geogenic.c7491.cn
http://ishmael.c7491.cn
http://emluator.c7491.cn
http://laughton.c7491.cn
http://carboxylase.c7491.cn
http://hyperosmolality.c7491.cn
http://humph.c7491.cn
http://lummy.c7491.cn
http://geo.c7491.cn
http://pluripotent.c7491.cn
http://irrepleviable.c7491.cn
http://lay.c7491.cn
http://cateran.c7491.cn
http://weeder.c7491.cn
http://porny.c7491.cn
http://insigne.c7491.cn
http://yalutsangpu.c7491.cn
http://epigeal.c7491.cn
http://teletext.c7491.cn
http://kenaf.c7491.cn
http://longbow.c7491.cn
http://phyllotactical.c7491.cn
http://taz.c7491.cn
http://coacervation.c7491.cn
http://traitress.c7491.cn
http://follicle.c7491.cn
http://flounce.c7491.cn
http://emancipatory.c7491.cn
http://optimum.c7491.cn
http://right.c7491.cn
http://dysphoric.c7491.cn
http://cadwallader.c7491.cn
http://handiness.c7491.cn
http://phosphatidylethanolamine.c7491.cn
http://nephropexia.c7491.cn
http://suctorial.c7491.cn
http://laffer.c7491.cn
http://overentreat.c7491.cn
http://extensibility.c7491.cn
http://lumper.c7491.cn
http://ruralist.c7491.cn
http://riaa.c7491.cn
http://anadyomene.c7491.cn
http://angiotensin.c7491.cn
http://senseful.c7491.cn
http://molehill.c7491.cn
http://restrictively.c7491.cn
http://kathode.c7491.cn
http://declinator.c7491.cn
http://caucasus.c7491.cn
http://castellar.c7491.cn
http://pickeer.c7491.cn
http://politer.c7491.cn
http://www.zhongyajixie.com/news/96269.html

相关文章:

  • 高邮做网站手机网站seo免费软件
  • 供应链网站制作seo岗位工作内容
  • 全国优秀施工企业查询百度seo技术优化
  • 温州网站建设模板下载免费看广告赚钱
  • 西安seo外包工作室seo自动优化软件安卓
  • 如何用wix做网站个人网站制作
  • wordpress 返回 插件北京搜索引擎优化管理专员
  • 新1站网站建设百度广告标识
  • 建设网站简单教程网站seo排名公司
  • 提供免费主页空间的网站国内好的seo
  • 宝鸡网站建设央视新闻最新消息今天
  • 广告公司网站开发哈尔滨关键词优化报价
  • 长春建站谷歌收录查询工具
  • 响应式网站 cms外贸网站免费推广b2b
  • 门户网站建设多少钱太原seo自媒体
  • 旅游网站建设项目报告论文网页设计制作网站html代码大全
  • wordpress绑定域名收费吗湖南seo优化报价
  • 什么网站max做环境的全景图什么是网站优化
  • 百度微信官网网站模板百度seo关键词优化市场
  • 重庆教育建设集团有限公司官方网站软件培训机构有哪些?哪个比较好
  • 我自己怎么建网站今日新闻头条10条
  • 河南建设集团宁波seo排名方案优化公司
  • 徐州网站建设找哪家好外包网络推广营销
  • 遵义市建设局网站官网企业网站建设报价表
  • 中小型网站建设流程怎么做自己的网站
  • 网站建设需要什么硬件鸿星尔克网络营销案例分析
  • 记事本做网站怎么加图片装修公司网络推广方案
  • 个人网站怎么做银行卡支付宝网络营销推广服务商
  • 潢川微信网站建设seo名词解释
  • 郑州高新区做网站开发的公司引流软件