当前位置: 首页>>代码示例>>Java>>正文


Java PKIFailureInfo.systemFailure方法代码示例

本文整理汇总了Java中org.bouncycastle.asn1.cmp.PKIFailureInfo.systemFailure方法的典型用法代码示例。如果您正苦于以下问题:Java PKIFailureInfo.systemFailure方法的具体用法?Java PKIFailureInfo.systemFailure怎么用?Java PKIFailureInfo.systemFailure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bouncycastle.asn1.cmp.PKIFailureInfo的用法示例。


在下文中一共展示了PKIFailureInfo.systemFailure方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPKiFailureInfo

import org.bouncycastle.asn1.cmp.PKIFailureInfo; //导入方法依赖的package包/类
private int getPKiFailureInfo(OperationException ex) {
    ErrorCode code = ex.errorCode();

    int failureInfo;
    switch (code) {
    case ALREADY_ISSUED:
        failureInfo = PKIFailureInfo.badRequest;
        break;
    case BAD_CERT_TEMPLATE:
        failureInfo = PKIFailureInfo.badCertTemplate;
        break;
    case BAD_REQUEST:
        failureInfo = PKIFailureInfo.badRequest;
        break;
    case CERT_REVOKED:
        failureInfo = PKIFailureInfo.certRevoked;
        break;
    case CERT_UNREVOKED:
        failureInfo = PKIFailureInfo.notAuthorized;
        break;
    case BAD_POP:
        failureInfo = PKIFailureInfo.badPOP;
        break;
    case CRL_FAILURE:
        failureInfo = PKIFailureInfo.systemFailure;
        break;
    case DATABASE_FAILURE:
        failureInfo = PKIFailureInfo.systemFailure;
        break;
    case NOT_PERMITTED:
        failureInfo = PKIFailureInfo.notAuthorized;
        break;
    case INVALID_EXTENSION:
        failureInfo = PKIFailureInfo.badRequest;
        break;
    case SYSTEM_FAILURE:
        failureInfo = PKIFailureInfo.systemFailure;
        break;
    case SYSTEM_UNAVAILABLE:
        failureInfo = PKIFailureInfo.systemUnavail;
        break;
    case UNKNOWN_CERT:
        failureInfo = PKIFailureInfo.badCertId;
        break;
    case UNKNOWN_CERT_PROFILE:
        failureInfo = PKIFailureInfo.badCertTemplate;
        break;
    default:
        failureInfo = PKIFailureInfo.systemFailure;
        break;
    } // end switch (code)

    return failureInfo;
}
 
开发者ID:xipki,项目名称:xipki,代码行数:55,代码来源:X509CaCmpResponderImpl.java

示例2: confirmCertificates

import org.bouncycastle.asn1.cmp.PKIFailureInfo; //导入方法依赖的package包/类
private PKIBody confirmCertificates(ASN1OctetString transactionId, CertConfirmContent certConf,
        String msgId) {
    CertStatus[] certStatuses = certConf.toCertStatusArray();

    boolean successful = true;
    for (CertStatus certStatus : certStatuses) {
        ASN1Integer certReqId = certStatus.getCertReqId();
        byte[] certHash = certStatus.getCertHash().getOctets();
        X509CertificateInfo certInfo = pendingCertPool.removeCertificate(
                transactionId.getOctets(), certReqId.getPositiveValue(), certHash);
        if (certInfo == null) {
            if (LOG.isWarnEnabled()) {
                LOG.warn("no cert under transactionId={}, certReqId={} and certHash=0X{}",
                        transactionId, certReqId.getPositiveValue(),
                        Hex.encode(certHash));
            }
            continue;
        }

        PKIStatusInfo statusInfo = certStatus.getStatusInfo();
        boolean accept = true;
        if (statusInfo != null) {
            int status = statusInfo.getStatus().intValue();
            if (PKIStatus.GRANTED != status && PKIStatus.GRANTED_WITH_MODS != status) {
                accept = false;
            }
        }

        if (accept) {
            continue;
        }

        BigInteger serialNumber = certInfo.cert().cert().getSerialNumber();
        X509Ca ca = getCa();
        try {
            ca.revokeCertificate(serialNumber, CrlReason.CESSATION_OF_OPERATION, new Date(),
                    msgId);
        } catch (OperationException ex) {
            LogUtil.warn(LOG, ex,
                    "could not revoke certificate ca=" + ca.caInfo().ident()
                    + " serialNumber=" + LogUtil.formatCsn(serialNumber));
        }

        successful = false;
    }

    // all other certificates should be revoked
    if (revokePendingCertificates(transactionId, msgId)) {
        successful = false;
    }

    if (successful) {
        return new PKIBody(PKIBody.TYPE_CONFIRM, DERNull.INSTANCE);
    }

    ErrorMsgContent emc = new ErrorMsgContent(
            new PKIStatusInfo(PKIStatus.rejection, null,
                    new PKIFailureInfo(PKIFailureInfo.systemFailure)));

    return new PKIBody(PKIBody.TYPE_ERROR, emc);
}
 
开发者ID:xipki,项目名称:xipki,代码行数:62,代码来源:X509CaCmpResponderImpl.java


注:本文中的org.bouncycastle.asn1.cmp.PKIFailureInfo.systemFailure方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。