use of org.xipki.ca.certprofile.commonpki.ProfessionInfoOption in project xipki by xipki.
the class XmlX509CertprofileUtil method buildAdmissionSyntax.
public static AdmissionSyntaxOption buildAdmissionSyntax(boolean critical, AdmissionSyntax type) throws CertprofileException {
List<AdmissionsOption> admissionsList = new LinkedList<>();
for (AdmissionsType at : type.getContentsOfAdmissions()) {
List<ProfessionInfoOption> professionInfos = new LinkedList<>();
for (ProfessionInfoType pi : at.getProfessionInfo()) {
NamingAuthority namingAuthorityL3 = null;
if (pi.getNamingAuthority() != null) {
namingAuthorityL3 = buildNamingAuthority(pi.getNamingAuthority());
}
List<OidWithDescType> oidTypes = pi.getProfessionOid();
List<ASN1ObjectIdentifier> oids = null;
if (CollectionUtil.isNonEmpty(oidTypes)) {
oids = new LinkedList<>();
for (OidWithDescType k : oidTypes) {
oids.add(new ASN1ObjectIdentifier(k.getValue()));
}
}
RegistrationNumber rnType = pi.getRegistrationNumber();
RegistrationNumberOption rno = (rnType == null) ? null : new RegistrationNumberOption(rnType.getRegex(), rnType.getConstant());
ProfessionInfoOption pio = new ProfessionInfoOption(namingAuthorityL3, pi.getProfessionItem(), oids, rno, pi.getAddProfessionInfo());
professionInfos.add(pio);
}
GeneralName admissionAuthority = null;
if (at.getNamingAuthority() != null) {
admissionAuthority = GeneralName.getInstance(asn1PrimitivefromByteArray(at.getAdmissionAuthority()));
}
NamingAuthority namingAuthority = null;
if (at.getNamingAuthority() != null) {
namingAuthority = buildNamingAuthority(at.getNamingAuthority());
}
AdmissionsOption admissionsOption = new AdmissionsOption(admissionAuthority, namingAuthority, professionInfos);
admissionsList.add(admissionsOption);
}
GeneralName admissionAuthority = null;
if (type.getAdmissionAuthority() != null) {
admissionAuthority = GeneralName.getInstance(type.getAdmissionAuthority());
}
return new AdmissionSyntaxOption(critical, admissionAuthority, admissionsList);
}
Aggregations