JSEncrypt使用
作者:互联网
import { JSEncrypt } from 'jsencrypt' // RSA加密 export const HkSetEncrypt = (pubKey, value) => { const encrypt = new JSEncrypt() encrypt.setPublicKey(pubKey) return encrypt.encrypt(value) } export function setEncrypt (str) { const key = `MIGeMA0GCSqGSSFFKHIUNFBKHIWMADCBiAKBgH9RB1AJw1b5f1eE52+icZplN40I eAooLdn9zb2tJCHmUQuFHaMAgUGTlrMYstjjy5MMvteZ3L0LmJd9g9Czyp2PQblk WEATn3YA9G00DiEgWJZ5HIDUUWBKOSWDGcFHhD2gvp62OaJPTkRvYgjv r+TvVdvVRo3DPT/rAgMBAAE=` const jsencrypt = new JSEncrypt() jsencrypt.setPublicKey(key) return jsencrypt.encrypt(str) }
标签:const,new,JSEncrypt,export,使用,encrypt,jsencrypt 来源: https://www.cnblogs.com/hlweng-0207/p/12971180.html