Search in sources :

Example 1 with RegistrationNumberOption

use of org.xipki.ca.certprofile.commonpki.RegistrationNumberOption 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);
}
Also used : ProfessionInfoOption(org.xipki.ca.certprofile.commonpki.ProfessionInfoOption) OidWithDescType(org.xipki.ca.certprofile.x509.jaxb.OidWithDescType) AdmissionsOption(org.xipki.ca.certprofile.commonpki.AdmissionsOption) RegistrationNumberOption(org.xipki.ca.certprofile.commonpki.RegistrationNumberOption) AdmissionSyntaxOption(org.xipki.ca.certprofile.commonpki.AdmissionSyntaxOption) LinkedList(java.util.LinkedList) AdmissionsType(org.xipki.ca.certprofile.x509.jaxb.AdmissionsType) ProfessionInfoType(org.xipki.ca.certprofile.x509.jaxb.ProfessionInfoType) NamingAuthority(org.bouncycastle.asn1.isismtt.x509.NamingAuthority) RegistrationNumber(org.xipki.ca.certprofile.x509.jaxb.ProfessionInfoType.RegistrationNumber) GeneralName(org.bouncycastle.asn1.x509.GeneralName) ASN1ObjectIdentifier(org.bouncycastle.asn1.ASN1ObjectIdentifier)

Aggregations

LinkedList (java.util.LinkedList)1 ASN1ObjectIdentifier (org.bouncycastle.asn1.ASN1ObjectIdentifier)1 NamingAuthority (org.bouncycastle.asn1.isismtt.x509.NamingAuthority)1 GeneralName (org.bouncycastle.asn1.x509.GeneralName)1 AdmissionSyntaxOption (org.xipki.ca.certprofile.commonpki.AdmissionSyntaxOption)1 AdmissionsOption (org.xipki.ca.certprofile.commonpki.AdmissionsOption)1 ProfessionInfoOption (org.xipki.ca.certprofile.commonpki.ProfessionInfoOption)1 RegistrationNumberOption (org.xipki.ca.certprofile.commonpki.RegistrationNumberOption)1 AdmissionsType (org.xipki.ca.certprofile.x509.jaxb.AdmissionsType)1 OidWithDescType (org.xipki.ca.certprofile.x509.jaxb.OidWithDescType)1 ProfessionInfoType (org.xipki.ca.certprofile.x509.jaxb.ProfessionInfoType)1 RegistrationNumber (org.xipki.ca.certprofile.x509.jaxb.ProfessionInfoType.RegistrationNumber)1