use of org.xipki.ca.certprofile.x509.jaxb.GeneralSubtreeBaseType in project xipki by xipki.
the class XmlX509CertprofileUtil method buildKeyUsageOptions.
// method toOidList
public static Set<KeyUsageControl> buildKeyUsageOptions(org.xipki.ca.certprofile.x509.jaxb.KeyUsage extConf) {
ParamUtil.requireNonNull("extConf", extConf);
List<UsageType> usages = extConf.getUsage();
Set<KeyUsageControl> controls = new HashSet<>();
for (UsageType m : usages) {
boolean required = m.isRequired();
switch(m.getValue()) {
case CRL_SIGN:
controls.add(new KeyUsageControl(KeyUsage.cRLSign, required));
break;
case DATA_ENCIPHERMENT:
controls.add(new KeyUsageControl(KeyUsage.dataEncipherment, required));
break;
case CONTENT_COMMITMENT:
controls.add(new KeyUsageControl(KeyUsage.contentCommitment, required));
break;
case DECIPHER_ONLY:
controls.add(new KeyUsageControl(KeyUsage.decipherOnly, required));
break;
case ENCIPHER_ONLY:
controls.add(new KeyUsageControl(KeyUsage.encipherOnly, required));
break;
case DIGITAL_SIGNATURE:
controls.add(new KeyUsageControl(KeyUsage.digitalSignature, required));
break;
case KEY_AGREEMENT:
controls.add(new KeyUsageControl(KeyUsage.keyAgreement, required));
break;
case KEY_CERT_SIGN:
controls.add(new KeyUsageControl(KeyUsage.keyCertSign, required));
break;
case KEY_ENCIPHERMENT:
controls.add(new KeyUsageControl(KeyUsage.keyEncipherment, required));
break;
default:
throw new RuntimeException("should not reach here, unknown GeneralSubtreeBaseType " + m.getValue());
}
}
return Collections.unmodifiableSet(controls);
}
use of org.xipki.ca.certprofile.x509.jaxb.GeneralSubtreeBaseType in project xipki by xipki.
the class ProfileConfCreatorDemo method createNameConstraints.
private static NameConstraints createNameConstraints() {
NameConstraints ret = new NameConstraints();
GeneralSubtreesType permitted = new GeneralSubtreesType();
GeneralSubtreeBaseType single = new GeneralSubtreeBaseType();
single.setDirectoryName("O=example organization, C=DE");
permitted.getBase().add(single);
ret.setPermittedSubtrees(permitted);
GeneralSubtreesType excluded = new GeneralSubtreesType();
single = new GeneralSubtreeBaseType();
single.setDirectoryName("OU=bad OU, O=example organization, C=DE");
excluded.getBase().add(single);
ret.setExcludedSubtrees(excluded);
return ret;
}
Aggregations