policeSecurity/policeManagement/src/utils/rsaUtil.ts

17 lines
300 B
TypeScript
Raw Normal View History

2024-08-29 17:06:00 +08:00
import {JSEncrypt} from "jsencrypt";
const rsa = new JSEncrypt()
rsa.setPublicKey(__APP_ENV.VITE_APP_RSA_PUBLIC_KEY)
const encryptStr = (text: string): string => {
const r = rsa.encrypt(text);
if (!r) {
throw "加密失败";
}
return r;
}
export default {
encryptStr
}