Search in sources :

Example 6 with CertificatePolicies

use of org.xipki.ca.certprofile.x509.jaxb.CertificatePolicies 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;
}
Also used : ArrayList(java.util.ArrayList) JAXBElement(javax.xml.bind.JAXBElement) DirectoryString(org.bouncycastle.asn1.x500.DirectoryString) CertificatePolicyQualifier(org.xipki.ca.api.profile.x509.CertificatePolicyQualifier) CertificatePolicyInformationType(org.xipki.ca.certprofile.x509.jaxb.CertificatePolicyInformationType) CertificatePolicyInformation(org.xipki.ca.api.profile.x509.CertificatePolicyInformation) PolicyQualifiers(org.xipki.ca.certprofile.x509.jaxb.CertificatePolicyInformationType.PolicyQualifiers)

Aggregations

ASN1ObjectIdentifier (org.bouncycastle.asn1.ASN1ObjectIdentifier)5 CertificatePolicies (org.xipki.ca.certprofile.x509.jaxb.CertificatePolicies)4 DirectoryString (org.bouncycastle.asn1.x500.DirectoryString)3 CertificatePolicyInformation (org.xipki.ca.api.profile.x509.CertificatePolicyInformation)3 ArrayList (java.util.ArrayList)2 ASN1Sequence (org.bouncycastle.asn1.ASN1Sequence)2 ExtensionValue (org.xipki.ca.api.profile.ExtensionValue)2 CertificatePolicyInformationType (org.xipki.ca.certprofile.x509.jaxb.CertificatePolicyInformationType)2 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 Map (java.util.Map)1 Vector (java.util.Vector)1 JAXBElement (javax.xml.bind.JAXBElement)1 ASN1Encodable (org.bouncycastle.asn1.ASN1Encodable)1 ASN1EncodableVector (org.bouncycastle.asn1.ASN1EncodableVector)1 ASN1GeneralizedTime (org.bouncycastle.asn1.ASN1GeneralizedTime)1