我是 JavaScript 或 GatewayScript 的新手。我有一个要求,我需要将 .pem(位于 DataPower 中的 local:///cert 下或可以添加到加密对象中)的内容转换为 JWK。
任何人都可以帮助我了解如何开发 javascript
- 从 DataPower 引用加密密钥对象(示例加密密钥对象 JWKCryptoCertObj)
- 解密加密密钥对象(例如 JWKCryptoCertObj.pem)
- 将密钥的内容转换为 JSON Web Key (
jwk.readCertificate()
)
到目前为止,我已经知道这jwk.readCertificate()
可以帮助我将关键对象转换为 JWK。
我已经尝试了下面的代码来获取它:
var jwk = require('jwk');
var myJWK = jwk.readCertificate('cerjwk');
console.log(myJWK);
但是,我在 DataPower 中收到以下错误:
3:13:17 AM mpgw error 1277869681 error 0x00d30003 mpgw (PortTest): Rejected by filter; SOAP fault sent
3:13:17 AM multistep error 1277869681 request 0x80c00009 mpgw (PortTest): request PortTest_Policy_rule_1 #2 gatewayscript: Transforming the content of INPUT. The transformation local:///jwk.js is applied. The results are stored in testop. failed: Internal Error
3:13:17 AM gatewayscript error 1277869681 request 0x85800007 mpgw (PortTest): GatewayScript processing Error 'Error: Named certificate 'cerjwk' not found In file 'gatewayscript:///modules/jwk.js' line:428, stack:Error: Named certificate 'cerjwk' not found at Object.readCertificate (gatewayscript:///modules/jwk.js:428:18) at Object. (local:///jwk.js:5:17) at Script.execute (gatewayscript:///datapower.js:155:24) at Object. (gatewayscript:///datapower.js:582:55)'
3:13:17 AM crypto error 1277869681 request 0x8580005c mpgw (PortTest): Named certificate 'cerjwk' not found
有人可以帮我解决这里的问题吗?提前致谢!!