use of org.xipki.ca.certprofile.xijson.conf.PolicyConstraints in project xipki by xipki.
the class O2tChecker method checkExtnPolicyConstraints.
void checkExtnPolicyConstraints(StringBuilder failureMsg, byte[] extnValue, Extensions requestedExtns, ExtensionControl extnControl) {
PolicyConstraints conf = caller.getPolicyConstraints();
if (conf == null) {
caller.checkConstantExtnValue(Extension.policyConstraints, failureMsg, extnValue, requestedExtns, extnControl);
return;
}
org.bouncycastle.asn1.x509.PolicyConstraints isPolicyConstraints = org.bouncycastle.asn1.x509.PolicyConstraints.getInstance(extnValue);
Integer expRequireExplicitPolicy = conf.getRequireExplicitPolicy();
BigInteger bigInt = isPolicyConstraints.getRequireExplicitPolicyMapping();
Integer isRequireExplicitPolicy = (bigInt == null) ? null : bigInt.intValue();
boolean match = true;
if (expRequireExplicitPolicy == null) {
if (isRequireExplicitPolicy != null) {
match = false;
}
} else if (!expRequireExplicitPolicy.equals(isRequireExplicitPolicy)) {
match = false;
}
if (!match) {
addViolation(failureMsg, "requireExplicitPolicy", isRequireExplicitPolicy, expRequireExplicitPolicy);
}
Integer expInhibitPolicyMapping = conf.getInhibitPolicyMapping();
bigInt = isPolicyConstraints.getInhibitPolicyMapping();
Integer isInhibitPolicyMapping = (bigInt == null) ? null : bigInt.intValue();
match = true;
if (expInhibitPolicyMapping == null) {
if (isInhibitPolicyMapping != null) {
match = false;
}
} else if (!expInhibitPolicyMapping.equals(isInhibitPolicyMapping)) {
match = false;
}
if (!match) {
addViolation(failureMsg, "inhibitPolicyMapping", isInhibitPolicyMapping, expInhibitPolicyMapping);
}
}
Aggregations