本文整理汇总了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");
}
}
示例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;
}
示例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);
}
}