Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bug: cert serial number must not negative #1192

Closed

Conversation

ethanvc
Copy link

@ethanvc ethanvc commented Jan 11, 2025

golang 1.23 这个版本不允许负数的证书编号:

arseCertificate parses a single certificate from the given ASN.1 DER data.

Before Go 1.23, ParseCertificate accepted certificates with negative serial numbers. This behavior can be restored by including "x509negativeserial=1" in the GODEBUG environment variable.

详情参考这里:https://pkg.go.dev/crypto/x509#ParseCertificate
golang官方http.Client返回错误:
Get "https://www.baidu.com/": tls: failed to parse certificate from server: x509: negative serial number

原因:whistle随机生成的序列号,有时候是负数。

@ethanvc
Copy link
Author

ethanvc commented Jan 11, 2025

@avwo please help cr

@avwo avwo closed this in eae6ce3 Jan 13, 2025
@avwo
Copy link
Owner

avwo commented Jan 13, 2025

感谢反馈,不能只是简单的删除一位,目前 serialNumber 长度是可变的,我这边处理了,更新下 Whistle 试试

@ethanvc
Copy link
Author

ethanvc commented Jan 17, 2025

翻了一下新的代码,并没有发现有做序列号为正相关的改变?
测试仍然会出现负数的序列号。
在浏览器中观察,下面的值就是证书序列号,需要以0-7开头,才是合法的正整数序列号。可以参考我的改动?
image

参考标准文档:https://www.rfc-editor.org/rfc/rfc3280.html#section-4.1.2.2

  1. 序列号必须是非负整数。
  2. 序列号的长度必须不超过20个字节表示(hex表示的时候不超过40个字符)。

@avwo

@avwo
Copy link
Owner

avwo commented Jan 20, 2025

下个版本修复

avwo added a commit that referenced this pull request Jan 20, 2025
avwo added a commit that referenced this pull request Jan 20, 2025
@avwo
Copy link
Owner

avwo commented Jan 20, 2025

@ethanvc 再试试

@ethanvc
Copy link
Author

ethanvc commented Jan 22, 2025

可以了~

@ethanvc ethanvc deleted the vc_fix_cert_series_number_negative_bug branch February 19, 2025 13:31
xcodebuild added a commit to xcodebuild/iProxy that referenced this pull request Feb 25, 2025
904573e931 fix the incorrect link of pipe.html
8f97f121ff Update pattern.md
512e58feda Release v2.9.94
0903b78849 refactor: refine ui
448688f9aa feat: Commands -> Install
c2282bf8b7 fix: avwo/whistle#1192
0d8ff36928 docs: README
4d9b5ddd71 Release v2.9.93
ea99d3af9b docs: README
ddb8968506 docs: sniCallback
53ec0394ce refactor: refine code
eae6ce353d fix: avwo/whistle#1192
5ab12d3466 refactor: refine ui
57cc1e1f91 feat: w2 ca --enable-https
7ce2ee9639 Release v2.9.92
6854677161 feat: set server.requestTime = 0
48b3f8b15c docs: pipe
77b1314734 feat: update express
623ded0ec6 refactor: refine code
d74c3dcad7 refactor: refine code
92f72eb5b8 feat: disable://keepH2Session
6dd4ee9c64 Release v2.9.91
aa4af22135 fix: avwo/whistle#1173
0812fd86cc Release v2.9.91
d6a1e92567 fix: avwo/whistle#1183
7be53e28bd fix: avwo/whistle#1081
2a26b619a4 Release v2.9.90
a076e7edc7 feat: search editor
fd94769422 refactor: refine ui
156cc1d277 refactor: refine ui
1d612a81c3 refactor: refine ui
8dd3b9ff9c refactor: refine code
b4211f5a70 Release v2.9.89
b1a3ba9b4b feat: parse curl
7eebcc7e9b refactor: refine code
ed07550b9a refactor: refine ui
1fb7dfd4ef Release v2.9.88
549dfc8a8a refactor: refine composer
828480e2ff fix: resolve keys
f7dba66c9c perf: captureStream
5678474cf4 docs: update
87944e5bd8 Release v2.9.87
f91f572a51 feat: delete://reqBody.xxx|resBody.xxx
b3c102e63d feat: refine ui
f79259cef8 test: reqMerge
0942e84a95 docs: delete
4479cf235b feat: delete://reqType|resType|reqCharset|resCharset
0d3de1f42e Release v2.9.87

git-subtree-dir: vendor/whistle
git-subtree-split: 904573e931d7afdb2dc19dfba6807e2fe575b337
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants