創建 ACME EAB 憑據
為證書創建 ACME External Account Binding(EAB)憑據。
EAB 憑據用於在 ACME 客戶端(如 acme.sh、Certbot、Caddy 等)中註冊賬戶,
實現證書的自動申請、續期和管理。首次創建會返回 eab_kid 和 directory(ACME 目錄地址);
HMAC Key 僅在首次創建時返回一次,後續調用不再包含,如需獲取新 HMAC Key 請使用輪換接口。
接口地址
POST /api/v1/certificate/acme/eab-create
Host:
...
完整地址
/api/v1/certificate/acme/eab-create
請求
Content-Type: application/json
Content-Length: 24
{
"service_id": "J94V73" // 證書編號,必填,下單時候返回的 `service_id`
}
響應
- 首次創建
- 已存在時再次調用
- errors
HTTP/1.1 200 OK
Content-Type: application/json
{
"success": true,
"data": {
"order_id": "TA-xxxxx", // CA 側訂單號
"directory": "https://acme.ca.example/directory", // ACME 目錄地址
"eab_kid": "eab-key-xxxxx", // EAB Key Identifier
"eab_mac_key": "hmac-key-xxxxx", // EAB HMAC Key(僅首次創建時返回,請立即保存)
"existing": false, // false = 本次新建,true = 已存在直接返回
"white_ips": [] // 當前 IP 白名單(空數組表示無限制)
}
}
HMAC Key 僅在創建時返回一次
eab_mac_key 僅在首次創建(existing 為 false)時返回,請立即保存到安全的位置。
後續調用本接口(existing 為 true)不再返回 eab_mac_key。
如需獲取新的 HMAC Key,請調用輪換 EAB 憑據 接口。
HTTP/1.1 200 OK
Content-Type: application/json
{
"success": true,
"data": {
"order_id": "TA-xxxxx",
"directory": "https://acme.ca.example/directory",
"eab_kid": "eab-key-xxxxx",
"existing": true, // true = 憑據已存在,直接返回
"white_ips": ["192.168.1.0/24"]
}
}
existing 為 true 時響應不含 eab_mac_key。
HTTP/1.1 400 Bad Request
Content-Type: application/json
{
"success": false,
"message": "該證書不支持 ACME EAB"
}
錯誤碼
| HTTP 狀態碼 | message | 含義與處理建議 |
|---|---|---|
| 400 | 該證書不支持 ACME EAB | 證書供應商無法創建 EAB 憑據 |
| 400 | 證書尚未提交至 CA | 證書還未提交至 CA(ca_order_number 為空),請先完成 證書申請流程 |
| 404 | The certificate is not found | 證書不存在,或不屬於當前 API 密鑰對應的工作空間 |
| 422 | The service ID is required | 未提供證書編號 service_id |
後續步驟
創建 EAB 憑據後,可在 ACME 客戶端中使用返回的 directory、eab_kid 和 eab_mac_key 完成註冊:
# acme.sh 示例
acme.sh --register-account -m my@example.com \
--server https://acme.ca.example/directory \
--eab-kid "eab-key-xxxxx" \
--eab-hmac-key "your-hmac-key"
如需限制只有特定 IP 才能使用此 EAB 憑據,請調用 更新 IP 白名單 接口。