js rsa加密

import { JSEncrypt } from "jsencrypt";

const publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC4bXHNd+M65FJWVNpUbaUJM/amiokVM4IKTdRIDwEQ4crWvtB3x2jk2vFJ0w2izHPqW5UPWs/zwhdy6Tq6d0FcuzgBK4bs527DSXb46TvpNZ7Rz8UuTi6GFrYfzuDyAHe8vnR7DTHAI4MEaPaxyuLKw365KGH42Cvf+2J54prBDwIDAQAB"; // 加密公钥

export const rsaEncrypt = (origin) => {
    let encrypt = new JSEncrypt();
    encrypt.setPublicKey(publicKey);
    return encrypt.encrypt(origin);
};

你可能感兴趣的:(js rsa加密)