首页 > 解决方案 > 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
};

标签: node.jspython-3.xrsa

解决方案


推荐阅读