更新记录
1.0.0(2025-06-21)
初始版本
平台兼容性
uni-app(4.26)
Vue2 |
Vue3 |
Chrome |
Safari |
app-vue |
app-nvue |
Android |
iOS |
鸿蒙 |
√ |
√ |
- |
- |
√ |
√ |
√ |
√ |
- |
微信小程序 |
支付宝小程序 |
抖音小程序 |
百度小程序 |
快手小程序 |
京东小程序 |
鸿蒙元服务 |
QQ小程序 |
飞书小程序 |
快应用-华为 |
快应用-联盟 |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
uni-app x(4.26)
Chrome |
Safari |
Android |
iOS |
鸿蒙 |
微信小程序 |
- |
- |
√ |
√ |
- |
- |
yzc-encry RSA加密、AES加密、base64加密,支持安卓、iOS(需要打自定义基座)
导入
import { EncryUtils } from '@/uni_modules/yzc-encry';
RSA加解密
// 设置钥匙对别名 必须
EncryUtils.setKeyAlias('xxxxx')
// 导出公钥
const publicKey = EncryUtils.exportPublicKey()
console.log(publicKey)
// rsa加密 返回值为string或者null 如果是uniappx使用string接收可以使用?? 操作符处理为null的情况
const rsa_encryptedData = EncryUtils.rsa_encrypt("your data", publicKey)
console.log("rsa_encrypt", rsa_encryptedData)
// rsa解密 返回值为string或者null
const rsa_decryptedData = EncryUtils.rsa_decrypt(rsa_encryptedData)
console.log("rsa_decrypt", rsa_decryptedData)
AES-256-CBC 加解密
// 密钥必须为16/24/32字节
const aes_key = "xxxx"
// AES 加密 返回值为string或者null
const aes_encryptedData = EncryUtils.aes256cbc_encrypt(aes_key, "your data")
console.log('aes_encrypt', aes_encryptedData)
// AES 解密 返回值为string或者null
const aes_decryptedData = EncryUtils.aes256cbc_decrypt(aes_key, aes_encryptedData)
console.log('aes_decrypt', aes_decryptedData)
base64加解密
// base64加密 返回值为string或者null
const base64_encryptedData = EncryUtils.base64_encrypt("your data")
console.log('base64_encrypt', base64_encryptedData)
// base64解密 返回值为string或者null
const base64_decryptedData = EncryUtils.base64_decrypt(base64_encryptedData)
console.log('base64_decrypt', base64_decryptedData)