use of org.xipki.ca.certprofile.x509.jaxb.CertificatePolicyInformationType.PolicyQualifiers in project xipki by xipki.
the class XmlX509CertprofileUtil method createCertificatePolicies.
public static org.bouncycastle.asn1.x509.CertificatePolicies createCertificatePolicies(List<CertificatePolicyInformation> policyInfos) throws CertprofileException {
ParamUtil.requireNonEmpty("policyInfos", policyInfos);
int size = policyInfos.size();
PolicyInformation[] infos = new PolicyInformation[size];
int idx = 0;
for (CertificatePolicyInformation policyInfo : policyInfos) {
String policyId = policyInfo.getCertPolicyId();
List<CertificatePolicyQualifier> qualifiers = policyInfo.getQualifiers();
ASN1Sequence policyQualifiers = null;
if (CollectionUtil.isNonEmpty(qualifiers)) {
policyQualifiers = createPolicyQualifiers(qualifiers);
}
ASN1ObjectIdentifier policyOid = new ASN1ObjectIdentifier(policyId);
infos[idx++] = (policyQualifiers == null) ? new PolicyInformation(policyOid) : new PolicyInformation(policyOid, policyQualifiers);
}
return new org.bouncycastle.asn1.x509.CertificatePolicies(infos);
}
use of org.xipki.ca.certprofile.x509.jaxb.CertificatePolicyInformationType.PolicyQualifiers in project xipki by xipki.
the class XmlX509CertprofileUtil method buildCertificatePolicies.
// method parse
public static List<CertificatePolicyInformation> buildCertificatePolicies(CertificatePolicies type) {
List<CertificatePolicyInformationType> policyPairs = type.getCertificatePolicyInformation();
List<CertificatePolicyInformation> policies = new ArrayList<CertificatePolicyInformation>(policyPairs.size());
for (CertificatePolicyInformationType policyPair : policyPairs) {
List<CertificatePolicyQualifier> qualifiers = null;
PolicyQualifiers policyQualifiers = policyPair.getPolicyQualifiers();
if (policyQualifiers != null) {
List<JAXBElement<String>> cpsUriOrUserNotice = policyQualifiers.getCpsUriOrUserNotice();
qualifiers = new ArrayList<CertificatePolicyQualifier>(cpsUriOrUserNotice.size());
for (JAXBElement<String> element : cpsUriOrUserNotice) {
String elementValue = element.getValue();
CertificatePolicyQualifier qualifier = null;
String elementName = element.getName().getLocalPart();
qualifier = "cpsUri".equals(elementName) ? CertificatePolicyQualifier.getInstanceForCpsUri(elementValue) : CertificatePolicyQualifier.getInstanceForUserNotice(elementValue);
qualifiers.add(qualifier);
}
}
CertificatePolicyInformation cpi = new CertificatePolicyInformation(policyPair.getPolicyIdentifier().getValue(), qualifiers);
policies.add(cpi);
}
return policies;
}
Aggregations