解析 X.509 证书与 PKCS#10 请求

POST/cert/parse
公开访问curl裸值兼容

解析一个 PEM 证书或证书签名请求,返回主体、SAN、签名与公钥算法及指纹。证书还包含签发者、序列号与有效期。仅解析内容,证书信任链由客户端单独验证。 访问类别:匿名 API,可携带 Token 使用独立额度

请求参数

_formatquery
响应格式为 json 或 text;_format=svg 返回 JSON。plain 是 text 的别名。未识别的值继续按 Accept 协商。
string · 可选:json、text
_colorquery
控制 text 响应的 ANSI 颜色。0、false、off、no 关闭;省略或其他值保留。
string · 可选:0、false、off、no

请求体

application/json
pem必填
string · 一个 PEM 格式的证书或 PKCS#10 证书签名请求。 · 最短:1 字符 · 最长:49152 字符

裸值请求体

可直接发送 pem 的 JSON 值。需要传入可选字段时,使用 JSON 对象。

响应

application/json

{
  "type": "object",
  "properties": {
    "kind": {
      "type": "string",
      "enum": [
        "certificate",
        "csr"
      ]
    },
    "subject": {
      "type": "string"
    },
    "issuer": {
      "type": [
        "string",
        "null"
      ]
    },
    "serialNumber": {
      "type": [
        "string",
        "null"
      ]
    },
    "subjectAltNames": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "dns",
              "ip",
              "email",
              "uri",
              "registered-id"
            ]
          },
          "value": {
            "type": "string"
          }
        },
        "required": [
          "type",
          "value"
        ]
      }
    },
    "signatureAlgorithm": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "oid": {
          "type": "string"
        },
        "hash": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "name",
        "oid",
        "hash"
      ]
    },
    "publicKey": {
      "type": "object",
      "properties": {
        "algorithm": {
          "type": "string"
        },
        "oid": {
          "type": "string"
        },
        "bits": {
          "type": [
            "integer",
            "null"
          ]
        },
        "curve": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "algorithm",
        "oid",
        "bits",
        "curve"
      ]
    },
    "validity": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "notBefore": {
          "type": "string"
        },
        "notAfter": {
          "type": "string"
        },
        "daysRemaining": {
          "type": "integer"
        },
        "status": {
          "type": "string",
          "enum": [
            "valid",
            "expired",
            "not-yet-valid"
          ]
        }
      },
      "required": [
        "notBefore",
        "notAfter",
        "daysRemaining",
        "status"
      ]
    },
    "fingerprints": {
      "type": "object",
      "properties": {
        "sha1": {
          "type": "string",
          "pattern": "^[a-f0-9]{40}$"
        },
        "sha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        }
      },
      "required": [
        "sha1",
        "sha256"
      ]
    }
  },
  "required": [
    "kind",
    "subject",
    "issuer",
    "serialNumber",
    "subjectAltNames",
    "signatureAlgorithm",
    "publicKey",
    "validity",
    "fingerprints"
  ]
}

响应示例

成功响应

curl -sS --json '"-----BEGIN CERTIFICATE-----\nMIIBOzCB4qADAgECAgIBIzAKBggqhkjOPQQDAjAWMRQwEgYDVQQDEwtleGFtcGxl\nLmNvbTAeFw0yNTAxMDEwMDAwMDBaFw0zNTAxMDEwMDAwMDBaMBYxFDASBgNVBAMT\nC2V4YW1wbGUuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAERChCVtBSUmw2\njun0FMnPrIg91FOD2SVNIF6xwhxwialCWyMkZkD8G/6lDSBpDD22W09x9X8Bez+z\nAuB4DYDDSqMgMB4wHAYDVR0RBBUwE4ILZXhhbXBsZS5jb22HBMAAAgEwCgYIKoZI\nzj0EAwIDSAAwRQIgL6PGFbal6btFNcjHzHAC+Go8X1dUEpFoaDxeB7mkSTsCIQCx\nHvwcOZfNI63MBa48hroSMrx47sthajqYuYT3GfkhJg==\n-----END CERTIFICATE-----"' https://oit.sh/cert/parse
HTTP 200
content-type: application/json
content-encoding: gzip
cache-control: no-store

{
  "kind": "certificate",
  "subject": "CN=example.com",
  "issuer": "CN=example.com",
  "serialNumber": "0123",
  "subjectAltNames": [
    {
      "type": "dns",
      "value": "example.com"
    },
    {
      "type": "ip",
      "value": "192.0.2.1"
    }
  ],
  "signatureAlgorithm": {
    "name": "ECDSA",
    "oid": "1.2.840.10045.4.3.2",
    "hash": "SHA-256"
  },
  "publicKey": {
    "algorithm": "ECDSA",
    "oid": "1.2.840.10045.2.1",
    "bits": 256,
    "curve": "P-256"
  },
  "validity": {
    "notBefore": "2025-01-01T00:00:00.000Z",
    "notAfter": "2035-01-01T00:00:00.000Z",
    "status": "valid",
    "daysRemaining": 2967
  },
  "fingerprints": {
    "sha1": "c4c7af17239023ff5b5186e12b31a7b4cb633c3f",
    "sha256": "eeb83f2b0722d43ed588b40312424b0c5fe39f708ebe88e23c651338d1f726ac"
  }
}

错误示例

curl -sS --json '{}' https://oit.sh/cert/parse
HTTP 400
content-type: application/json
content-encoding: gzip
cache-control: no-store

{
  "error": {
    "code": "INVALID_INPUT",
    "message": "参数无效",
    "issues": [
      {
        "location": "body",
        "field": "pem",
        "code": "invalid_type",
        "message": "需要 字符串 类型"
      }
    ]
  }
}

curl 访问示例

curl、wget、HTTPie 默认得到 text/plain。示例展示纯文本输出。

命令与输出

curl -sS --json '"-----BEGIN CERTIFICATE-----\nMIIBOzCB4qADAgECAgIBIzAKBggqhkjOPQQDAjAWMRQwEgYDVQQDEwtleGFtcGxl\nLmNvbTAeFw0yNTAxMDEwMDAwMDBaFw0zNTAxMDEwMDAwMDBaMBYxFDASBgNVBAMT\nC2V4YW1wbGUuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAERChCVtBSUmw2\njun0FMnPrIg91FOD2SVNIF6xwhxwialCWyMkZkD8G/6lDSBpDD22W09x9X8Bez+z\nAuB4DYDDSqMgMB4wHAYDVR0RBBUwE4ILZXhhbXBsZS5jb22HBMAAAgEwCgYIKoZI\nzj0EAwIDSAAwRQIgL6PGFbal6btFNcjHzHAC+Go8X1dUEpFoaDxeB7mkSTsCIQCx\nHvwcOZfNI63MBa48hroSMrx47sthajqYuYT3GfkhJg==\n-----END CERTIFICATE-----"' 'https://oit.sh/cert/parse?_color=0&_format=text'
HTTP 200
content-type: text/plain; charset=utf-8
content-encoding: gzip
cache-control: no-store

kind: certificate
subject: CN=example.com
issuer: CN=example.com
serialNumber: 0123
subjectAltNames:
  - 
    type: dns
    value: example.com
  - 
    type: ip
    value: 192.0.2.1
signatureAlgorithm:
  name: ECDSA
  oid: 1.2.840.10045.4.3.2
  hash: SHA-256
publicKey:
  algorithm: ECDSA
  oid: 1.2.840.10045.2.1
  bits: 256
  curve: P-256
validity:
  notBefore: 2025-01-01T00:00:00.000Z
  notAfter: 2035-01-01T00:00:00.000Z
  status: valid
  daysRemaining: 2967
fingerprints:
  sha1: c4c7af17239023ff5b5186e12b31a7b4cb633c3f
  sha256: eeb83f2b0722d43ed588b40312424b0c5fe39f708ebe88e23c651338d1f726ac

在线调试

必填
Ctrl / ⌘ + Enter
curl -X POST 'https://oit.sh/cert/parse' \
  -H 'Content-Type: application/json' \
  --data-raw '{"pem":"-----BEGIN CERTIFICATE-----\nMIIBOzCB4qADAgECAgIBIzAKBggqhkjOPQQDAjAWMRQwEgYDVQQDEwtleGFtcGxl\nLmNvbTAeFw0yNTAxMDEwMDAwMDBaFw0zNTAxMDEwMDAwMDBaMBYxFDASBgNVBAMT\nC2V4YW1wbGUuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAERChCVtBSUmw2\njun0FMnPrIg91FOD2SVNIF6xwhxwialCWyMkZkD8G/6lDSBpDD22W09x9X8Bez+z\nAuB4DYDDSqMgMB4wHAYDVR0RBBUwE4ILZXhhbXBsZS5jb22HBMAAAgEwCgYIKoZI\nzj0EAwIDSAAwRQIgL6PGFbal6btFNcjHzHAC+Go8X1dUEpFoaDxeB7mkSTsCIQCx\nHvwcOZfNI63MBa48hroSMrx47sthajqYuYT3GfkhJg==\n-----END CERTIFICATE-----"}'

响应

等待请求

等待发送请求