Search in sources :

Example 1 with RevokeResult

use of com.itrus.raapi.result.RevokeResult in project portal by ixinportal.

the class MobileCertificateService method revokeCertByApi.

// api方式吊销证书
private void revokeCertByApi(RaAccount raAccount, MobileCertificate mobileCert) throws RaServiceUnavailable_Exception {
    // 创建RaCertManager类
    RaCertManager raCertManager = RaFactory.getRaCertManager(raAccount.getAccountOrganization(), raAccount.getAccountOrgUnit());
    raCertManager.setAccountHash(raAccount.getAccountHash());
    // 设置RA服务IP地址、端口号和协议等
    raCertManager.addRaService(raAccount.getServiceUrl());
    RevokeResult revokeResult = null;
    try {
        // 对证书序列号进行一次转换,适应ICA的证书序列号方式
        revokeResult = raCertManager.revokeCert(CertUtils.getICAValidSerialNumber(mobileCert.getSequenceNumber()), ComNames.AA_PASS_PORT, RevokeReasonEnum.KeyCompromise);
        if (!revokeResult.isSuccess())
            throw new RaServiceUnavailable_Exception(revokeResult.getMessage());
    } catch (RaServiceUnavailable e) {
        // 服务全部停止
        throw new RaServiceUnavailable_Exception(e.getMessage());
    }
}
Also used : RaServiceUnavailable_Exception(cn.topca.tca.ra.service.RaServiceUnavailable_Exception) RaCertManager(com.itrus.raapi.RaCertManager) RaServiceUnavailable(com.itrus.raapi.exception.RaServiceUnavailable) RevokeResult(com.itrus.raapi.result.RevokeResult)

Aggregations

RaServiceUnavailable_Exception (cn.topca.tca.ra.service.RaServiceUnavailable_Exception)1 RaCertManager (com.itrus.raapi.RaCertManager)1 RaServiceUnavailable (com.itrus.raapi.exception.RaServiceUnavailable)1 RevokeResult (com.itrus.raapi.result.RevokeResult)1