Search in sources :

Example 6 with ExtensionControl

use of org.xipki.ca.api.profile.ExtensionControl in project xipki by xipki.

the class XmlX509CertprofileUtil method buildExtensionControls.

// method buildKeyAlgorithms
public static Map<ASN1ObjectIdentifier, ExtensionControl> buildExtensionControls(ExtensionsType extensionsType) throws CertprofileException {
    ParamUtil.requireNonNull("extensionsType", extensionsType);
    // Extension controls
    Map<ASN1ObjectIdentifier, ExtensionControl> controls = new HashMap<>();
    for (ExtensionType m : extensionsType.getExtension()) {
        ASN1ObjectIdentifier oid = new ASN1ObjectIdentifier(m.getType().getValue());
        if (controls.containsKey(oid)) {
            throw new CertprofileException("duplicated definition of extension " + oid.getId());
        }
        ExtensionControl ctrl = new ExtensionControl(m.isCritical(), m.isRequired(), m.isPermittedInRequest());
        controls.put(oid, ctrl);
    }
    return Collections.unmodifiableMap(controls);
}
Also used : HashMap(java.util.HashMap) CertprofileException(org.xipki.ca.api.profile.CertprofileException) ExtensionControl(org.xipki.ca.api.profile.ExtensionControl) ExtensionType(org.xipki.ca.certprofile.x509.jaxb.ExtensionType) ASN1ObjectIdentifier(org.bouncycastle.asn1.ASN1ObjectIdentifier)

Aggregations

ASN1ObjectIdentifier (org.bouncycastle.asn1.ASN1ObjectIdentifier)6 ExtensionControl (org.xipki.ca.api.profile.ExtensionControl)6 HashSet (java.util.HashSet)3 Extension (org.bouncycastle.asn1.x509.Extension)3 CertprofileException (org.xipki.ca.api.profile.CertprofileException)3 ExtKeyUsageControl (org.xipki.ca.api.profile.x509.ExtKeyUsageControl)3 KeyUsageControl (org.xipki.ca.api.profile.x509.KeyUsageControl)3 HashMap (java.util.HashMap)2 LinkedList (java.util.LinkedList)2 CRLDistPoint (org.bouncycastle.asn1.x509.CRLDistPoint)2 ExtendedKeyUsage (org.bouncycastle.asn1.x509.ExtendedKeyUsage)2 ExtensionValue (org.xipki.ca.api.profile.ExtensionValue)2 ExtensionValues (org.xipki.ca.api.profile.ExtensionValues)2 ExtensionExistence (org.xipki.security.ExtensionExistence)2 KeyUsage (org.xipki.security.KeyUsage)2 CertificateException (java.security.cert.CertificateException)1 X509Certificate (java.security.cert.X509Certificate)1 ASN1Sequence (org.bouncycastle.asn1.ASN1Sequence)1 DERNull (org.bouncycastle.asn1.DERNull)1 DERUTF8String (org.bouncycastle.asn1.DERUTF8String)1