Skip to content

证书合规与 Lint

"这张证书写得对不对?"——合规检查关注证书是否遵守了 X.509 与 CA/Browser Forum 的规范。crt.sh 内置 5 个 linter,SDK 全部可用。

边搜边 lint5 个 linterOCSP / OneCRL / PKI Metal合规三证据

5 个 Linter

📋cablint
CA/Browser Forum 基线要求
🔧x509lint
X.509 结构问题
🛡️zlint
综合性证书 lint(最常用)
🔑keylint
密钥质量
lint (all)
全部一起跑

不知道选哪个?按关注点走:

flowchart TD Q["你想查什么?"] --> Q1{证书是否违反
CA/B Forum 基线?} Q1 -->|是| CAB["cablint"] Q1 -->|否| Q2{X.509 结构有问题?
编码/扩展/时间格式} Q2 -->|是| X9["x509lint"] Q2 -->|否| Q3{密钥强度够不够?
RSA < 2048 / 弱算法} Q3 -->|是| KL["keylint"] Q3 -->|否| Q4{想要综合体检,
一次看全?} Q4 -->|是| ZL["zlint — 最常用"] Q4 -->|否| ALL["lint all — 五个全跑"]

2 种 Lint 输出类型

类型含义
1 week最近一周的 lint 结果摘要
issues只展示有问题的项

搜索时边 lint

QueryParams.Linter + LintType 让你在搜索时就带上 lint:

go
certs, _, _ := client.SearchCertificates(ctx, crtsh.QueryParams{
    Q:         "example.com",
    Linter:    "zlint",
    LintType:  "issues",
})

buildQuery 把它翻译成 ?zlint=issues——linter 名即参数名

flowchart LR Q["QueryParams{Linter:'zlint',LintType:'issues'}"] --> B["buildQuery: ?zlint=issues"] B --> CRT["crt.sh 边搜边 lint"] CRT --> R["带 lint 标记的证书结果"]

合规证据的三条腿

合规不只看 lint。完整的"可信"判断需要三条证据:

flowchart TB subgraph 合规["合规判断"] L["Lint 结果
证书本身写对没"] R["吊销信号
OCSP / OneCRL / revoked-intermediates"] P["路径校验
整条链能信吗"] end L --> AND{三者结合} R --> AND P --> AND AND --> OK["✓ 合规且可信"]

Lint(本页)

SearchCertificatesLinter 参数,或对单证走 GetCertificateByIDPkimetal 选项(?opt=pkimetal)触发 PKI Metal 深度 lint。

吊销信号

crt.sh 的信息页提供多条吊销证据,SDK 都可通过 FetchInfoPage 取:

页面 path含义
revoked-intermediates已吊销的中间 CA 证书列表
mozilla-onecrlMozilla OneCRL 吊销列表
ocsp-responders各 CA 的 OCSP 响应器

加上 GetCertificateByIDOCSPCheck 选项(?opt=ocsp)做实时 OCSP 核验,以及 CertificateDetail 里的 Revocations 字段(parseRevocations 从详情页抠出吊销记录)。

路径校验

路径校验FetchPathValidationView 给出整条链的信任结论。

三条腿的组合

go
certs, _, _ := client.SearchCertificates(ctx, crtsh.QueryParams{
    Q: "example.com", Linter: "zlint", LintType: "issues",
})
go
detail, _ := client.GetCertificateByID(ctx, certs[0].ID, crtsh.WithOCSPCheck())
// detail.Revocations
go
pv, _ := client.FetchPathValidationView(ctx, certs[0].ID)

结论

三者结合,才能说"这张证书合规且可被信任"。