# SSLCertService
> SSL证书管理服务

---

## countAllSSLCertsWithOCSPError
> 计算有OCSP错误的证书数量

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/SSLCertService/countAllSSLCertsWithOCSPError`
- RPC：`rpc countAllSSLCertsWithOCSPError (CountAllSSLCertsWithOCSPErrorRequest) returns (RPCCountResponse);`

**请求对象 (`CountAllSSLCertsWithOCSPErrorRequest`)**

```json
{
  "keyword": "string // 关键词"
}
```

**响应对象 (`RPCCountResponse`)**

```json
{
  "count": "int64 // 数量"
}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/SSLCertService/countAllSSLCertsWithOCSPError" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## countSSLCerts
> 计算匹配的证书数量

- 角色：`admin`, `user`
- HTTP：`POST https://backend.dooki.cloud/SSLCertService/countSSLCerts`
- RPC：`rpc countSSLCerts (CountSSLCertRequest) returns (RPCCountResponse);`

**请求对象 (`CountSSLCertRequest`)**

```json
{
  "isCA": "bool // 可选项，是否为CA证书",
  "isAvailable": "bool // 可选项，是否可用（在有效期内）",
  "isExpired": "bool // 可选项，是否已过期",
  "expiringDays": "int32 // 可选项，离过期日的天数",
  "keyword": "string // 可选项，关键词",
  "userId": "int64 // 可选项，用户ID，不填则表示读取管理员上传的证书",
  "domains": "[]string // 可选项，搜索使用的域名列表",
  "userOnly": "bool // 可选项，只列出用户上传的证书"
}
```

**响应对象 (`RPCCountResponse`)**

```json
{
  "count": "int64 // 数量"
}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/SSLCertService/countSSLCerts" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## createSSLCert
> 创建证书

- 角色：`admin`, `user`
- HTTP：`POST https://backend.dooki.cloud/SSLCertService/createSSLCert`
- RPC：`rpc createSSLCert (CreateSSLCertRequest) returns (CreateSSLCertResponse);`

**请求对象 (`CreateSSLCertRequest`)**

```json
{
  "isOn": "bool // 是否启用",
  "userId": "int64 // 所属用户，仅管理员才能指定",
  "name": "string // 名称",
  "description": "string // 描述（备注）",
  "serverName": "string",
  "isCA": "bool",
  "certData": "bytes",
  "keyData": "bytes",
  "timeBeginAt": "int64",
  "timeEndAt": "int64",
  "dnsNames": "[]string",
  "commonNames": "[]string"
}
```

**响应对象 (`CreateSSLCertResponse`)**

```json
{
  "sslCertId": "int64"
}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/SSLCertService/createSSLCert" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## createSSLCerts
> 创建一组证书

- 角色：`admin`, `user`
- HTTP：`POST https://backend.dooki.cloud/SSLCertService/createSSLCerts`
- RPC：`rpc createSSLCerts(CreateSSLCertsRequest) returns (CreateSSLCertsResponse);`

**请求对象 (`CreateSSLCertsRequest`)**

```json
{
  "SSLCerts": "[]cert // 证书信息",
  "userId": "int64 // 用户ID",
  "isOn": "bool // 是否启用",
  "name": "string // 名称",
  "description": "string // 描述（备注）",
  "serverName": "string",
  "isCA": "bool",
  "certData": "bytes",
  "keyData": "bytes",
  "timeBeginAt": "int64",
  "timeEndAt": "int64",
  "dnsNames": "[]string",
  "commonNames": "[]string"
}
```

**响应对象 (`CreateSSLCertsResponse`)**

```json
{
  "sslCertIds": "[]int64"
}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/SSLCertService/createSSLCerts" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## deleteSSLCert
> 删除证书

- 角色：`admin`, `user`
- HTTP：`POST https://backend.dooki.cloud/SSLCertService/deleteSSLCert`
- RPC：`rpc deleteSSLCert (DeleteSSLCertRequest) returns (RPCSuccess);`

**请求对象 (`DeleteSSLCertRequest`)**

```json
{
  "sslCertId": "int64"
}
```

**响应对象 (`RPCSuccess`)**

```json
{}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/SSLCertService/deleteSSLCert" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## findEnabledSSLCertConfig
> 查找证书配置

- 角色：`admin`, `user`
- HTTP：`POST https://backend.dooki.cloud/SSLCertService/findEnabledSSLCertConfig`
- RPC：`rpc findEnabledSSLCertConfig (FindEnabledSSLCertConfigRequest) returns (FindEnabledSSLCertConfigResponse);`

**请求对象 (`FindEnabledSSLCertConfigRequest`)**

```json
{
  "sslCertId": "int64"
}
```

**响应对象 (`FindEnabledSSLCertConfigResponse`)**

```json
{
  "sslCertJSON": "bytes"
}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/SSLCertService/findEnabledSSLCertConfig" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## findSSLCertUser
> 查找证书所属用户

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/SSLCertService/findSSLCertUser`
- RPC：`rpc findSSLCertUser(FindSSLCertUserRequest) returns (FindSSLCertUserResponse);`

**请求对象 (`FindSSLCertUserRequest`)**

```json
{
  "sslCertId": "int64 // 证书ID"
}
```

**响应对象 (`FindSSLCertUserResponse`)**

```json
{
  "user": "User // 用户信息，只包含几个基本的信息"
}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/SSLCertService/findSSLCertUser" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## ignoreSSLCertsWithOCSPError
> 忽略一组OCSP证书错误

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/SSLCertService/ignoreSSLCertsWithOCSPError`
- RPC：`rpc ignoreSSLCertsWithOCSPError (IgnoreSSLCertsWithOCSPErrorRequest) returns (RPCSuccess);`

**请求对象 (`IgnoreSSLCertsWithOCSPErrorRequest`)**

```json
{
  "sslCertIds": "[]int64"
}
```

**响应对象 (`RPCSuccess`)**

```json
{}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/SSLCertService/ignoreSSLCertsWithOCSPError" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## listSSLCerts
> 列出单页匹配的证书

- 角色：`admin`, `user`
- HTTP：`POST https://backend.dooki.cloud/SSLCertService/listSSLCerts`
- RPC：`rpc listSSLCerts (ListSSLCertsRequest) returns (ListSSLCertsResponse);`

**请求对象 (`ListSSLCertsRequest`)**

```json
{
  "isCA": "bool // 可选项，是否为CA证书",
  "isAvailable": "bool // 可选项，是否可用（在有效期内）",
  "isExpired": "bool // 可选项， 是否已过期",
  "expiringDays": "int32 // 可选项，离过期日的天数",
  "keyword": "string // 可选项，关键词",
  "userId": "int64 // 可选项，用户ID，不填则表示读取管理员上传的证书",
  "domains": "[]string // 可选项，搜索使用的域名列表",
  "offset": "int64 // 读取位置",
  "size": "int64 // 读取长度，不能小于0",
  "userOnly": "bool // 可选项，只列出用户上传的证书"
}
```

**响应对象 (`ListSSLCertsResponse`)**

```json
{
  "sslCertsJSON": "bytes"
}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/SSLCertService/listSSLCerts" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## listSSLCertsWithOCSPError
> 列出有OCSP错误的证书

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/SSLCertService/listSSLCertsWithOCSPError`
- RPC：`rpc listSSLCertsWithOCSPError (ListSSLCertsWithOCSPErrorRequest) returns (ListSSLCertsWithOCSPErrorResponse);`

**请求对象 (`ListSSLCertsWithOCSPErrorRequest`)**

```json
{
  "keyword": "string // 关键词",
  "offset": "int64 // 读取位置",
  "size": "int64 // 数量，通常不能小于0"
}
```

**响应对象 (`ListSSLCertsWithOCSPErrorResponse`)**

```json
{
  "sslCerts": "[]SSLCert"
}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/SSLCertService/listSSLCertsWithOCSPError" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## resetAllSSLCertsWithOCSPError
> 重置所有证书OCSP错误状态

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/SSLCertService/resetAllSSLCertsWithOCSPError`
- RPC：`rpc resetAllSSLCertsWithOCSPError (ResetAllSSLCertsWithOCSPErrorRequest) returns (RPCSuccess);`

**请求对象 (`ResetAllSSLCertsWithOCSPErrorRequest`)**

```json
{}
```

**响应对象 (`RPCSuccess`)**

```json
{}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/SSLCertService/resetAllSSLCertsWithOCSPError" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## resetSSLCertsWithOCSPError
> 重置一组证书OCSP错误状态

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/SSLCertService/resetSSLCertsWithOCSPError`
- RPC：`rpc resetSSLCertsWithOCSPError (ResetSSLCertsWithOCSPErrorRequest) returns (RPCSuccess);`

**请求对象 (`ResetSSLCertsWithOCSPErrorRequest`)**

```json
{
  "sslCertIds": "[]int64"
}
```

**响应对象 (`RPCSuccess`)**

```json
{}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/SSLCertService/resetSSLCertsWithOCSPError" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## updateSSLCert
> 修改证书

- 角色：`admin`, `user`
- HTTP：`POST https://backend.dooki.cloud/SSLCertService/updateSSLCert`
- RPC：`rpc updateSSLCert (UpdateSSLCertRequest) returns (RPCSuccess);`

**请求对象 (`UpdateSSLCertRequest`)**

```json
{
  "sslCertId": "int64",
  "isOn": "bool // 是否启用",
  "name": "string // 名称",
  "description": "string // 描述（备注）",
  "serverName": "string",
  "isCA": "bool",
  "certData": "bytes",
  "keyData": "bytes",
  "timeBeginAt": "int64",
  "timeEndAt": "int64",
  "dnsNames": "[]string",
  "commonNames": "[]string"
}
```

**响应对象 (`RPCSuccess`)**

```json
{}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/SSLCertService/updateSSLCert" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---
