uni-app 实现小程序rsa加密(非对称加密原理)

uni-app 小程序 rsa 加密 使用的是 jsencryptmain.js文件//引入js文件import security_http_config from './common/security.js'//封装的接口Vue.prototype.proims = (data, url, contentType) => { //重要的地方 **let currentKey = security_http_config.createKey();** const token_u =
摘要由CSDN通过智能技术生成

uni-app 小程序 rsa 加密 使用的是 jsencrypt

main.js文件

//引入js文件
import security_http_config from './common/security.js'

//封装的接口
Vue.prototype.proims = (data, url, contentType) => {
	//重要的地方
	**let currentKey = security_http_config.createKey();**
	const token_u = uni.getStorageSync('token');
	data.token = token_u;
	return new Promise((resolve, u) => {
		uni.request({
			url: httpurl + url,
			//重要的地方
			**data: security_http_config.transform('post', data, currentKey),**
			method: 'post',
			header: {
				token: uni.getStorageSync('token'),
				//重要的地方
				'Content-Type': contentType || "application/json",
				ff8d82a3d6654309b17c97289c9c78fc: 'headerEncoding:base64;contentEncoding:base64',
				ff974421535f45508a8931b6432ffbf5: security_http_config.rsa(currentKey, uni
					.getStorageSync('key'))
			},
			dataType: 'json',
	
  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值