Search in sources :

Example 6 with ExtensionValue

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

the class XmlX509Certprofile method initAdditionalInformation.

private void initAdditionalInformation(Set<ASN1ObjectIdentifier> extnIds, ExtensionsType extensionsType) throws CertprofileException {
    ASN1ObjectIdentifier type = ObjectIdentifiers.id_extension_additionalInformation;
    if (!extensionControls.containsKey(type)) {
        return;
    }
    extnIds.remove(type);
    AdditionalInformation extConf = (AdditionalInformation) getExtensionValue(type, extensionsType, AdditionalInformation.class);
    if (extConf == null) {
        return;
    }
    DirectoryStringType stringType = XmlX509CertprofileUtil.convertDirectoryStringType(extConf.getType());
    ASN1Encodable extValue = stringType.createDirectoryString(extConf.getText());
    additionalInformation = new ExtensionValue(extensionControls.get(type).isCritical(), extValue);
}
Also used : AdditionalInformation(org.xipki.ca.certprofile.x509.jaxb.AdditionalInformation) ExtensionValue(org.xipki.ca.api.profile.ExtensionValue) ASN1Encodable(org.bouncycastle.asn1.ASN1Encodable) DirectoryStringType(org.xipki.ca.api.profile.DirectoryStringType) ASN1ObjectIdentifier(org.bouncycastle.asn1.ASN1ObjectIdentifier)

Example 7 with ExtensionValue

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

the class XmlX509Certprofile method initPolicyConstraints.

private void initPolicyConstraints(Set<ASN1ObjectIdentifier> extnIds, ExtensionsType extensionsType) throws CertprofileException {
    ASN1ObjectIdentifier type = Extension.policyConstraints;
    if (!extensionControls.containsKey(type)) {
        return;
    }
    extnIds.remove(type);
    PolicyConstraints extConf = (PolicyConstraints) getExtensionValue(type, extensionsType, PolicyConstraints.class);
    if (extConf == null) {
        return;
    }
    ASN1Sequence value = XmlX509CertprofileUtil.buildPolicyConstrains(extConf);
    this.policyConstraints = new ExtensionValue(extensionControls.get(type).isCritical(), value);
}
Also used : PolicyConstraints(org.xipki.ca.certprofile.x509.jaxb.PolicyConstraints) ASN1Sequence(org.bouncycastle.asn1.ASN1Sequence) ExtensionValue(org.xipki.ca.api.profile.ExtensionValue) ASN1ObjectIdentifier(org.bouncycastle.asn1.ASN1ObjectIdentifier)

Example 8 with ExtensionValue

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

the class XmlX509Certprofile method initCertificatePolicies.

private void initCertificatePolicies(Set<ASN1ObjectIdentifier> extnIds, ExtensionsType extensionsType) throws CertprofileException {
    ASN1ObjectIdentifier type = Extension.certificatePolicies;
    if (!extensionControls.containsKey(type)) {
        return;
    }
    extnIds.remove(type);
    CertificatePolicies extConf = (CertificatePolicies) getExtensionValue(type, extensionsType, CertificatePolicies.class);
    if (extConf == null) {
        return;
    }
    List<CertificatePolicyInformation> policyInfos = XmlX509CertprofileUtil.buildCertificatePolicies(extConf);
    org.bouncycastle.asn1.x509.CertificatePolicies value = XmlX509CertprofileUtil.createCertificatePolicies(policyInfos);
    this.certificatePolicies = new ExtensionValue(extensionControls.get(type).isCritical(), value);
}
Also used : ExtensionValue(org.xipki.ca.api.profile.ExtensionValue) CertificatePolicies(org.xipki.ca.certprofile.x509.jaxb.CertificatePolicies) CertificatePolicyInformation(org.xipki.ca.api.profile.x509.CertificatePolicyInformation) ASN1ObjectIdentifier(org.bouncycastle.asn1.ASN1ObjectIdentifier)

Example 9 with ExtensionValue

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

the class XmlX509Certprofile method initNameConstraints.

private void initNameConstraints(Set<ASN1ObjectIdentifier> extnIds, ExtensionsType extensionsType) throws CertprofileException {
    ASN1ObjectIdentifier type = Extension.nameConstraints;
    if (!extensionControls.containsKey(type)) {
        return;
    }
    extnIds.remove(type);
    NameConstraints extConf = (NameConstraints) getExtensionValue(type, extensionsType, NameConstraints.class);
    if (extConf == null) {
        return;
    }
    org.bouncycastle.asn1.x509.NameConstraints value = XmlX509CertprofileUtil.buildNameConstrains(extConf);
    this.nameConstraints = new ExtensionValue(extensionControls.get(type).isCritical(), value);
}
Also used : NameConstraints(org.xipki.ca.certprofile.x509.jaxb.NameConstraints) ExtensionValue(org.xipki.ca.api.profile.ExtensionValue) ASN1ObjectIdentifier(org.bouncycastle.asn1.ASN1ObjectIdentifier)

Example 10 with ExtensionValue

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

the class XmlX509Certprofile method initTlsFeature.

private void initTlsFeature(Set<ASN1ObjectIdentifier> extnIds, ExtensionsType extensionsType) throws CertprofileException {
    ASN1ObjectIdentifier type = ObjectIdentifiers.id_pe_tlsfeature;
    if (!extensionControls.containsKey(type)) {
        return;
    }
    extnIds.remove(type);
    TlsFeature extConf = (TlsFeature) getExtensionValue(type, extensionsType, TlsFeature.class);
    if (extConf == null) {
        return;
    }
    List<Integer> features = new ArrayList<>(extConf.getFeature().size());
    for (IntWithDescType m : extConf.getFeature()) {
        int value = m.getValue();
        if (value < 0 || value > 65535) {
            throw new CertprofileException("invalid TLS feature (extensionType) " + value);
        }
        features.add(value);
    }
    Collections.sort(features);
    ASN1EncodableVector vec = new ASN1EncodableVector();
    for (Integer m : features) {
        vec.add(new ASN1Integer(m));
    }
    ASN1Encodable extValue = new DERSequence(vec);
    tlsFeature = new ExtensionValue(extensionControls.get(type).isCritical(), extValue);
}
Also used : TlsFeature(org.xipki.ca.certprofile.x509.jaxb.TlsFeature) ArrayList(java.util.ArrayList) ASN1Integer(org.bouncycastle.asn1.ASN1Integer) ASN1Integer(org.bouncycastle.asn1.ASN1Integer) BigInteger(java.math.BigInteger) DERSequence(org.bouncycastle.asn1.DERSequence) ExtensionValue(org.xipki.ca.api.profile.ExtensionValue) CertprofileException(org.xipki.ca.api.profile.CertprofileException) ASN1EncodableVector(org.bouncycastle.asn1.ASN1EncodableVector) IntWithDescType(org.xipki.ca.certprofile.x509.jaxb.IntWithDescType) ASN1Encodable(org.bouncycastle.asn1.ASN1Encodable) ASN1ObjectIdentifier(org.bouncycastle.asn1.ASN1ObjectIdentifier)

Aggregations

ExtensionValue (org.xipki.ca.api.profile.ExtensionValue)19 ASN1ObjectIdentifier (org.bouncycastle.asn1.ASN1ObjectIdentifier)18 ASN1Encodable (org.bouncycastle.asn1.ASN1Encodable)9 DERSequence (org.bouncycastle.asn1.DERSequence)7 ASN1EncodableVector (org.bouncycastle.asn1.ASN1EncodableVector)6 CertprofileException (org.xipki.ca.api.profile.CertprofileException)6 ExtensionValues (org.xipki.ca.api.profile.ExtensionValues)5 ASN1Integer (org.bouncycastle.asn1.ASN1Integer)4 ASN1Sequence (org.bouncycastle.asn1.ASN1Sequence)4 DEROctetString (org.bouncycastle.asn1.DEROctetString)4 DERUTF8String (org.bouncycastle.asn1.DERUTF8String)4 BadCertTemplateException (org.xipki.ca.api.BadCertTemplateException)4 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 HashSet (java.util.HashSet)3 DERPrintableString (org.bouncycastle.asn1.DERPrintableString)3 DirectoryString (org.bouncycastle.asn1.x500.DirectoryString)3 IOException (java.io.IOException)2 LinkedList (java.util.LinkedList)2 List (java.util.List)2