小编FST*_*STL的帖子

RSA_padding_check_PKCS1_OAEP_mgf1:oaep 解码错误

我正在尝试使用 iOS swift(客户端)在将某些数据发送到 node.js 服务器以对其进行解密之前对其进行加密。但是,在 node.js 中解密时,我遇到了:

Error: error:04099079:rsa routines:RSA_padding_check_PKCS1_OAEP_mgf1:oaep decoding error
    at Object.privateDecrypt (internal/crypto/cipher.js:53:12)
    at decrypt (/Users/iosbeta/Documents/RSA/RSANode/testRsa.js:20:28)
    at Object.<anonymous> (/Users/RSANode/testRsa.js:36:13)
    at Module._compile (internal/modules/cjs/loader.js:777:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:788:10)
    at Module.load (internal/modules/cjs/loader.js:643:32)
    at Function.Module._load (internal/modules/cjs/loader.js:556:12)
    at Function.Module.runMain (internal/modules/cjs/loader.js:840:10)
    at internal/main/run_main_module.js:17:11 {
  library: 'rsa routines',
  function: 'RSA_padding_check_PKCS1_OAEP_mgf1',
  reason: 'oaep decoding error',
  code: 'ERR_OSSL_RSA_OAEP_DECODING_ERROR'
}
Run Code Online (Sandbox Code Playgroud)

我尝试仅使用 node.js 代码进行加密和解密,并且可以正常工作。但是,在使用 iOS 加密并使用 node.js 解密后,我无法让它工作。下面是我在 node.js 中生成证书、加密和解密的方法:

// ****************************************************************************************************************
// For generating keys
// ****************************************************************************************************************


const { writeFileSync } = require('fs')
const { generateKeyPairSync } = require('crypto') …
Run Code Online (Sandbox Code Playgroud)

node.js ios swift

9
推荐指数
0
解决办法
5904
查看次数

标签 统计

ios ×1

node.js ×1

swift ×1