ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
## RSA数据加密 > 方法:**yunj.rsaEncrypt(data, publicKey)** | 参数 | 类型 | 必须 | 说明 | | --- | --- | --- | --- | | `data` | string | 是 | 待加密数据 | | `publicKey` | string | 是 | RSA公钥 | 返回值:`Promise<string>` > 示例: ```javascript layui.use(['yunj'],function (){ let data = "123"; let publicKey= "***********************"; yunj.rsaEncrypt(data,publicKey).then(encrypted=>{ console.log(encrypted); // 输出:FWHx+J7vrgR1DfqPjDZtEudrp9au/SgmqKCjJZERj7bVdjsVMbRwDn8lYFDTIqeiFlDaDoLvSQXjmpp/QkTLGsG5BmxQjgghauXmNnuWlZkbs5AMiyx1jFA4vbRlCT3k6272MtzGqDXP9U3hyd6iFkC2JnIF/GNiBZk1mDZVpcHLtUttEcdTQrYWOBBu1b/8O2AilTDNauWxvb7C4DHyUdxJ9VpVBUBlIQoYQK/N+SMQbvF2GNHofDUFGMujYOTmMOxsIr16dYppAjzAV/n9tYm3QqBvtfsCyZHohjruhfhBTow9KEVLUk6ZLbZgTY2e7QigxkRfnrrHLnzJ/UJBkQ== }) }); ```