```js /** * rsa加密 * @param data 加密的字符串 * @returns 但会一个加密的base64位字符串 */ export const rasEncrypt = (data) => { if (!data) throw new Error('params "data" is null') const publicK = forge.pki.publicKeyFromPem(publicKey) const encrypted = publicK.encrypt(encodeURIComponent(data), 'RSA-OAEP', { md: forge.md.sha256.create(), mgf1: { md: forge.md.sha1.create() } }) return window.btoa(encrypted) } ``` An error occurred while encrypting,But it works fine on the browser side <img width="1139" alt="image" src="https://user-images.githubusercontent.com/34115313/207531204-85558c31-05a1-442b-813c-4196e2bb9eff.png">
Activity
SuyashSrivastavaZiroh commentedon Jan 3, 2023
+1 , Please do reply , if you got any solution
Thulof commentedon Mar 1, 2025
Hi, @pengyinghao @SuyashSrivastavaZiroh
I have created a PR #1110 to fix this issue.