Can't change algorithm
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 30/100
- Issue 类型
- 缺陷
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- javascript, node.js
调研方向
先运行提供的 jwt.sign 复现代码,然后通过 node_modules/jsonwebtoken/sign.js、node_modules/jws/lib/sign-stream.js 和 node_modules/jwa/index.js 跟踪调用。比较 ES256 和 README RS256 两种情况,包括提供的密钥值。完成标准是确定失败发生在算法处理还是 PEM 输入,并记录或修复可复现的原因。
由索引模型根据 Issue 内容生成。
描述
Description
Trying to use ES256 by passing algorithm: 'ES256' into options and getting:
Error: error:0908F066:PEM routines:get_header_and_data:bad end line
at Sign.sign (node:internal/crypto/sig:131:29)
at sign (/Users/liamdoyle/Developer/limegorilla/apple-jwt-node-test/node_modules/jwa/index.js:152:45)
at Object.sign (/Users/liamdoyle/Developer/limegorilla/apple-jwt-node-test/node_modules/jwa/index.js:200:27)
at Object.jwsSign [as sign] (/Users/liamdoyle/Developer/limegorilla/apple-jwt-node-test/node_modules/jws/lib/sign-stream.js:32:24)
at Object.module.exports [as sign] (/Users/liamdoyle/Developer/limegorilla/apple-jwt-node-test/node_modules/jsonwebtoken/sign.js:204:16)
at file:///Users/liamdoyle/Developer/limegorilla/apple-jwt-node-test/app.js:22:26
at ModuleJob.run (node:internal/modules/esm/module_job:185:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:281:24)
at async loadESM (node:internal/process/esm_loader:88:5) {
library: 'PEM routines',
function: 'get_header_and_data',
reason: 'bad end line',
code: 'ERR_OSSL_PEM_BAD_END_LINE'
Reproduction
let generatedToken = jwt.sign({
iss: teamId, // Required by Apple
exp: Math.floor(Date.now() / 1000) + (60 * 60),
}, token, {
algorithm: 'ES256',
header: {
kid: keyId
}
});
Also tried using this example from the readme:
jwt.sign({ foo: 'bar' }, privateKey, { algorithm: 'RS256' });
Same error.
Environment
Node 16.3
jsonwebtoken 8.5.1
macOS 12
- 主要语言
- JavaScript
- 星标
- 18.2k
- 派生
- 1.3k
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
auth0/node-jsonwebtoken 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
auth0/node-jsonwebtoken#1042 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 84/100
auth0/node-jsonwebtoken#1000 · 2 条评论 · 1 个 reaction ·
-
难度 4/5 3-5 天 新手友好度 65/100
auth0/node-jsonwebtoken#1046 ·
-
难度 5/5 一周以上 新手友好度 10/100
auth0/node-jsonwebtoken#1034 ·
-
难度 3/5 1-2 天 新手友好度 48/100
auth0/node-jsonwebtoken#1032 ·
查看 auth0/node-jsonwebtoken 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 65/100
antfu-collective/icones#398 ·
-
ECmail.com 未关闭
难度 1/5 1 小时以内 新手友好度 90/100
wesbos/burner-email-providers#554 ·
-
难度 2/5 1-3 小时 新手友好度 65/100
radiantearth/stac-browser#1023 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 75/100
components-web-app/docs#92 ·