encrypt.js 691 Bytes



let PK = 'B5FE03847F02046C47292AF0FF2DE88977241483DD40C123046EB39CBE4C48167B120096CFF12CD16559322884A3C56FA92B07B89AB51FC8C91A75127622151DDD730DFF1F993D5A290CEAC0BBA7FC88285D8994ACBAFF50101EDE9A0925AD5DFFAFE96D53C370E9C5B37DF2F871F81C4D7CA6B7EC37FF459C07975AD9A74A95';
let E = '10001';
PK = process.env.VUE_APP_RSA_PUBLIC_KEY || PK;
E = process.env.VUE_APP_RSA_KEY_INDEX || E;

function passwordEncrypt(rawPwd) {
    let rsa = new RSAKey();
    // console.log("rsa === ", rsa);
    rsa.setPublic(PK, E);
    let res = rsa.encrypt(rawPwd);
    // console.log("res === ", res);
    if (res == null) return rawPwd;
    return res;
}

module.exports = {
    passwordEncrypt: passwordEncrypt
}