当前位置:网站首页>Jmeter secondary development to realize rsa encryption
Jmeter secondary development to realize rsa encryption
2022-08-03 01:03:00 【Rejoice in the testing world】
jmeterFunctions assistant provides a large number of,像 counter、digest、random、split、strLen,These functions in the interface test、Performance testing is used in great quantities,But everyone in the practical work,A variety of test requirements of different,导致jmeterBuilt-in or extensions provide us all the function can't meet,This time we can diy,对JMeter进行二次开发.
Then I takeaesEncryption to illustrate how to realizeJMeter二次开发.
首先需要将jmeter的core、functions两个jar包导入到项目工程中.
这两个jar包在jmeter的lib\ext目录下,Integrity of the package name as shown below:
ApacheJMeter_core.jar
ApacheJMeter_functions.jar
接下来定义类,类名Rsa0706,继承抽象类AbstractFunction,
实现其中的4个方法execute()、setParameters()、getReferenceKey()、getArgumentDesc(),具体代码如下所示:
1、getReferenceKey方法实现
getReferenceKey()The name of the method is used to return a custom function,The following code defines a class member variablekey,值为字符串“__rsa”,key The value of this variable asgetReferenceKey()方法的返回值.
2,getArgumentDesc方法实现
getArgumentDesc()用来定义jmeterDescription of each parameter information,
Let's be encapsulatedjmeter的rsaEncryption function has two into the,Respectively is encrypted string(即明文),As well as the public key encryption,如下代码所示,定义类成员变量desc,To save the description of the two into the reference information as the variable,作为getArgumentDesc()方法的返回值.
3,setParameters方法实现
setParameters()方法用于获取JMeterFunction of the parameter values,咱们rsaEncryption need two into the reference,Are clear、公钥,参数个数是2,在setParameters()Methods need to check into the maximum number of arguments、The minimum value is2,Then the parameter collectionCollectionInto the array toObject数组变量values中,And define a class member variableMAX_PARA_COUNT、MIX_PARA_COUNT、plaintextCV、publicKeyCV,Are stored the biggest variable number、The minimum number of variables、明文、公钥.
4,execute方法实现
方法execute()里定义的是JmeterThe main logic code a custom function,Let's put in hereaesThe business logic of the encryption method to realize
Then debugging good project intojar包,拷贝到jmeter的lib\ext目录下.
启动jmeter,可以在jmeterThe function of assistant interface to see,自定义的__rsa函数,如下截图所示.
例如公钥:
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQClvArPDQsHpny6fNi1dVyjwz6GTtuKZ5hy8qb62ndCiGXgH5d9WSPeH6RIA14SMGwFwXAd2btntdmvs0CXtSDRP7cXiomEDgBSoDyNbjblQWFKKresjHuxka37rKUgwsDmsaCBE75nUVghJnqmZBhmZ/m9USdsfBbKPogpuVrNtwIDAQAB
1234567890This string of clear afterrsaPublic-key encryption after,结果如下截图所示
b9U55CVXTK+LOWuJPscL/074YtDNTr7fQCitxr73Sq9y4/P7q+TY+lm/L5QpTI8cpnJc6Q6V2I6WSUHFsSFmibwsAacdlIWbvjGxIy2z7F+Y0Ymj32GsFpbi85ea4GFhvrvzYDKp1IRUqo4oCWSwx6zV43gD3NFQHaoKKaU91As=
Then debugging good project intojar包,拷贝到jmeter的lib\ext目录下.
启动jmeter,可以在jmeterThe function of assistant interface to see,自定义的__rsa函数,如下截图所示.
例如公钥:
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQClvArPDQsHpny6fNi1dVyjwz6GTtuKZ5hy8qb62ndCiGXgH5d9WSPeH6RIA14SMGwFwXAd2btntdmvs0CXtSDRP7cXiomEDgBSoDyNbjblQWFKKresjHuxka37rKUgwsDmsaCBE75nUVghJnqmZBhmZ/m9USdsfBbKPogpuVrNtwIDAQAB
1234567890This string of clear afterrsaPublic-key encryption after,结果如下截图所示
b9U55CVXTK+LOWuJPscL/074YtDNTr7fQCitxr73Sq9y4/P7q+TY+lm/L5QpTI8cpnJc6Q6V2I6WSUHFsSFmibwsAacdlIWbvjGxIy2z7F+Y0Ymj32GsFpbi85ea4GFhvrvzYDKp1IRUqo4oCWSwx6zV43gD3NFQHaoKKaU91As=
最后: 可以在公众号:伤心的辣条 ! 自行领取一份216页软件测试工程师面试宝典文档资料【免费的】.以及相对应的视频学习教程免费分享!,其中包括了有基础知识、Linux必备、Shell、互联网程序原理、Mysql数据库、抓包工具专题、接口测试工具、测试进阶-Python编程、Web自动化测试、APP自动化测试、接口自动化测试、测试高级持续集成、测试架构开发测试框架、性能测试、安全测试等.
现在我邀请你进入我们的软件测试学习交流群:【746506216
】,备注“入群”, 大家可以一起探讨交流软件测试,共同学习软件测试技术、面试等软件测试方方面面,还会有免费直播课,收获更多测试技巧,我们一起进阶Python自动化测试/测试开发,走向高薪之路.
喜欢软件测试的小伙伴们,如果我的博客对你有帮助、如果你喜欢我的博客内容,请 “点赞” “评论” “收藏” 一 键三连哦!
软件测试工程师自学教程:
这才是2022最精细的自动化测试自学教程,我把它刷了无数遍才上岸字节跳动,做到涨薪20K【值得自学软件测试的人刷】
软件测试工程师月薪2W以上薪资必学技能 — Python接口自动化框架封装.
美团面试真题_高级测试25K岗位面试 — 软件测试人都应该看看
软件测试必会_Jmeter大厂实战 — 仅6步可实现接口自动化测试
边栏推荐
- How many ways do you know the singleton pattern?
- YAML文件格式
- 测试人生 | 阿里实习 90 天:从实习生的视角谈谈个人成长
- mysql查询表中重复记录
- Yocto系列讲解[实战篇]85 - 制作ubi镜像和自动挂载ubifs文件系统
- 最新真实软件测试面试题分享,收藏了还怕进入不了大厂?
- Software testing pen questions 1 (with answers)
- MYSQL查看表结构
- How does Redis easily achieve system instant kill?
- Teach you how to kill if else
猜你喜欢
IP Protocol (Internet Protocol)
刚安装完win10专业工作站版,系统变量中Path默认值有哪些?重新建一个“PATH”变量名,会覆盖掉原先的“Path”。
GameStop NFT 市场分析
VMware workstation 程序启动慢
H.265视频流媒体播放器EasyPlayer.js集成时出现“SourceBuffer ”报错,该如何解决?
How to seize the new trend of NFT, yuan|universe|universe?
Finally understand: With threads, why do we need coroutines?
centos7安装mysql8
双轴晶体中的锥形折射
目前为止 DAO靠什么盈利?
随机推荐
SRv6网络演进面临的挑战
Sentinel vs Hystrix 限流对比,到底怎么选?
WebShell 木马免杀过WAF
软件测试笔试题1(附答案)
软件测试到底自学还是报班?
Software testing pen questions 1 (with answers)
openssl源码下载
R语言自学 1 - 向量
go os 包
牛客刷题:数组排序
ROS2初级知识(9):bag记录过程数据和重放
Web APIs BOM- 操作浏览器-Window对象
图像识别从零写出dnf脚本关键要点
2022-08-02 第六小组 瞒春 学习笔记
Kubernetes 进阶训练营 网络
Towards a General Purpose CNN for Long Range Dependencies in ND
反弹shell原理与实现
刚安装完win10专业工作站版,系统变量中Path默认值有哪些?重新建一个“PATH”变量名,会覆盖掉原先的“Path”。
双轴晶体中锥形折射的建模与应用
Finally understand: With threads, why do we need coroutines?