package cn.unitid.matrix.pkiservice.test.kms;

import cn.unitid.matrix.pkiservice.sdk.ApiException;
import cn.unitid.matrix.pkiservice.sdk.PkiClient;
import cn.unitid.matrix.pkiservice.sdk.PkiOkhttpClient;
import cn.unitid.matrix.pkiservice.sdk.kms.request.CertRevokeRequest;
import cn.unitid.matrix.pkiservice.sdk.kms.response.CertRevokeResponse;

/**
 * 注销证书
 */
public class CertRevokeTest {

    public static void main(String[] args) {
        // 提供的URL
        String url = "http://localhost:9200";

        // 您的appKey
        String appKey = "CLxUIrYIO0";

        // 您的appSecret
        String appSecret = "Rsl7kjMrqHrxhDk9uou23IYRnCVjRKJC";

        // 1.原客户端
        PkiClient pkiClient = new PkiOkhttpClient(url, appKey, appSecret);

        CertRevokeRequest request = new CertRevokeRequest();

        //证书id
        request.setCertId("63512d8a00c7887adcc6da5a");

        try {
            CertRevokeResponse response = pkiClient.execute(request);
            // 后续业务
            if (response.isSuccess()) {
                System.out.println("成功响应：" + response.getResult());
            } else {
                System.out.println("失败响应：" + response.getBody());
            }
        } catch (ApiException e) {
            e.printStackTrace();
        }

    }
}
