node.js - Python中的Nodejs Crypto RSA_NO_PADDING等价物?
问题描述
我正在使用 nodejs Crypto RSA 集成一个 API。问题是他们正在使用我无法在 python 中解密的 crypto.constants.RSA_NO_PADDING 。我已经尝试过 pycrypto、密码学、pycryptodome,但仍然没有希望。这是nodejs加密功能。请给我一些希望:(。
const encryptWithPubKey = (buffer, keyPath, rsaPadding = crypto.constants.RSA_NO_PADDING) => {
const pubKey = fs.readFileSync(keyPath)
const encrypter = { key: pubKey, padding: rsaPadding }
const encrypted = crypto.publicEncrypt(encrypter, buffer).toString('base64')
return encrypted
};
解决方案
推荐阅读
- reactjs - React Router v4 渲染组件两次
- postgresql - Alter TYPE RENAME VALUE 在 Postgres 10 中有效,但在 Postgres 9.6 中无效?
- javascript - 删除成功时从表中删除行?
- c# - 来自 SeleniumExtras 的 FindsBy 找不到 IWebElement
- c# - c# 2个线程同时使用graphics.CopyFromScreen
- netsuite - 在记录浏览器项的已保存搜索中查找表和字段
- javascript - 对 API 的请求在服务器中不起作用,但在浏览器中起作用
- angular - WebpackHotUpdate 未定义 Angular 2+
- python - 在特定元素出现之前计算列表中的元素数
- c# - 如何将带有状态变量的 C# Linq 查询重写为 T-SQL