mPaaS小程序使用国密算法sm2加密传参

news/2024/7/24 1:28:46 标签: 小程序, 算法
  • 使用 miniprogram-sm-crypto
  • 使用文档
  • npm i miniprogram-sm-crypto
  • 引入

const sm2 = require(‘miniprogram-sm-crypto’).sm2;

  • 在js文件里
const sm2 = require('miniprogram-sm-crypto').sm2;
const smTwo = {
    sm2,
    cipherMode: 1, // 1 - C1C3C2,0 - C1C2C3,默认为1
    sm2publickey: '' // 公钥
};
  • 使用
import { smTwo } from './ulit'; //导入
const result = smTwo.sm2.doEncrypt(data, smTwo.sm2publickey, smTwo.cipherMode); //加密后的结果

解密 :需要私钥
const res = smTwo.sm2.doEncrypt(result , ‘私钥’, smTwo.cipherMode); //解密后的结果


http://www.niftyadmin.cn/n/1364945.html

相关文章

windows API编写的提取文件属性的程序

用VC6.0的编译环境&#xff0c;建的是win32 console application#include <stdafx.h>#include <string.h>#include <windows.h>DWORD ShowFileTime(PFILETIME lptime){ //文件时间结构 FILETIME ftLocal; //系统时间结构 SYSTEMTIME st; //调整为系统所在时区…

vue2 antdesign menu 渲染多级菜单

示例数据 //path 自行配置 const menu [{title: 示例1,icon: laptop,path: ,children: [{title: 示例1-1,icon: laptop,path: },{title: 示例1-2,icon: laptop,path: }]}{title: 示例2,icon: laptop,path: ,children: [{title: 示例2-1,icon: laptop,path: ,children: [{titl…

计算机系统基本硬件结构示意图

转载于:https://www.cnblogs.com/licb/archive/2013/05/22/3092303.html

mPaaS小程序一些记录

mpaas 小程序介绍 mPaaS 小程序&#xff0c;源自于支付宝小程序框架&#xff0c;继承了支付宝小程序框架的易开发性、跨平台性以及 Native 性能&#xff0c;不仅帮助开发者实现面向自有 App 投放小程序&#xff0c;还可快速构建打包&#xff0c;覆盖支付宝、淘宝、钉钉等应用。…

LigerUI java struts2配置

1、从官网下载 lib放到webroot下 2、 struts2 对json支持的jar包 3、 简单&#xff01;&#xff01;转载于:https://www.cnblogs.com/istianyu/archive/2013/05/22/3093768.html

小程序展示base64图片

base64图片如果不包含类似于【data:image/png;base64,】&#xff0c;这个字符串。 let base64Img base64字符串 base64Img data:image/png;base64, base64Img ;如果包含【data:image/png;base64,】。 <image mode"widthFix" src"{{base64Img}}" /&…

hdu 4528(bfs)

题目链接&#xff1a;http://acm.hdu.edu.cn/showproblem.php?pid4528 思路&#xff1a;结构体里面不仅要记录x,y,time&#xff0c;还要有2个bool型来记录是否看到二明和大明&#xff0c;因此&#xff0c;对于状态判重&#xff0c;开个4位数组mark[x][y][tag1][tag2]&#xff…

vue2切换页面回到顶部

export default new VueRouter({mode:,//切换页面回到顶部scrollBehavior(to, from, savedPosition) {return { x: 0, y: 0 }},routes:[], })