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


Java PKIFailureInfo.badRequest方法代码示例

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


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

示例1: testEncoding

import org.bouncycastle.asn1.cmp.PKIFailureInfo; //导入方法依赖的package包/类
private void testEncoding()
    throws IOException
{
    DERBitString bitString = (DERBitString)new ASN1InputStream(CORRECT_FAILURE_INFO).readObject();
    PKIFailureInfo correct = new PKIFailureInfo(bitString);
                    
    PKIFailureInfo bug = new PKIFailureInfo(PKIFailureInfo.badRequest | PKIFailureInfo.badTime |PKIFailureInfo.badDataFormat | PKIFailureInfo.incorrectData);

    if (!areEqual(correct.getEncoded(ASN1Encoding.DER),bug.getEncoded(ASN1Encoding.DER)))
    {
        fail("encoding doesn't match");
    }
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:14,代码来源:PKIFailureInfoTest.java

示例2: 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

示例3: cmpUnRevokeRemoveCertificates

import org.bouncycastle.asn1.cmp.PKIFailureInfo; //导入方法依赖的package包/类
private PKIBody cmpUnRevokeRemoveCertificates(PKIMessage request, PKIHeaderBuilder respHeader,
        CmpControl cmpControl, PKIHeader reqHeader, PKIBody reqBody, CmpRequestorInfo requestor,
        String msgId, AuditEvent event) {
    Integer requiredPermission = null;
    boolean allRevdetailsOfSameType = true;

    RevReqContent rr = RevReqContent.getInstance(reqBody.getContent());
    RevDetails[] revContent = rr.toRevDetailsArray();

    int len = revContent.length;
    for (int i = 0; i < len; i++) {
        RevDetails revDetails = revContent[i];
        Extensions crlDetails = revDetails.getCrlEntryDetails();
        int reasonCode = CrlReason.UNSPECIFIED.code();
        if (crlDetails != null) {
            ASN1ObjectIdentifier extId = Extension.reasonCode;
            ASN1Encodable extValue = crlDetails.getExtensionParsedValue(extId);
            if (extValue != null) {
                reasonCode = ASN1Enumerated.getInstance(extValue).getValue().intValue();
            }
        }

        if (reasonCode == XiSecurityConstants.CMP_CRL_REASON_REMOVE) {
            if (requiredPermission == null) {
                event.addEventType(CaAuditConstants.TYPE_CMP_rr_remove);
                requiredPermission = PermissionConstants.REMOVE_CERT;
            } else if (requiredPermission != PermissionConstants.REMOVE_CERT) {
                allRevdetailsOfSameType = false;
                break;
            }
        } else if (reasonCode == CrlReason.REMOVE_FROM_CRL.code()) {
            if (requiredPermission == null) {
                event.addEventType(CaAuditConstants.TYPE_CMP_rr_unrevoke);
                requiredPermission = PermissionConstants.UNREVOKE_CERT;
            } else if (requiredPermission != PermissionConstants.UNREVOKE_CERT) {
                allRevdetailsOfSameType = false;
                break;
            }
        } else {
            if (requiredPermission == null) {
                event.addEventType(CaAuditConstants.TYPE_CMP_rr_revoke);
                requiredPermission = PermissionConstants.REVOKE_CERT;
            } else if (requiredPermission != PermissionConstants.REVOKE_CERT) {
                allRevdetailsOfSameType = false;
                break;
            }
        }
    } // end for

    if (!allRevdetailsOfSameType) {
        ErrorMsgContent emc = new ErrorMsgContent(
                new PKIStatusInfo(PKIStatus.rejection,
                new PKIFreeText("not all revDetails are of the same type"),
                new PKIFailureInfo(PKIFailureInfo.badRequest)));

        return new PKIBody(PKIBody.TYPE_ERROR, emc);
    } else {
        try {
            checkPermission(requestor, requiredPermission);
        } catch (InsuffientPermissionException ex) {
            event.setStatus(AuditStatus.FAILED);
            event.addEventData(CaAuditConstants.NAME_message, "NOT_PERMITTED");
            return buildErrorMsgPkiBody(PKIStatus.rejection, PKIFailureInfo.notAuthorized,
                    null);
        }
        return unRevokeRemoveCertificates(request, rr, requiredPermission, cmpControl, msgId);
    }
}
 
开发者ID:xipki,项目名称:xipki,代码行数:69,代码来源:X509CaCmpResponderImpl.java


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