Search in sources :

Example 16 with ExtensionValue

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

the class XmlX509Certprofile method initAuthorizationTemplate.

private void initAuthorizationTemplate(Set<ASN1ObjectIdentifier> extnIds, ExtensionsType extensionsType) throws CertprofileException {
    ASN1ObjectIdentifier type = ObjectIdentifiers.id_xipki_ext_authorizationTemplate;
    if (!extensionControls.containsKey(type)) {
        return;
    }
    extnIds.remove(type);
    AuthorizationTemplate extConf = (AuthorizationTemplate) getExtensionValue(type, extensionsType, AuthorizationTemplate.class);
    if (extConf == null) {
        return;
    }
    ASN1EncodableVector vec = new ASN1EncodableVector();
    vec.add(new ASN1ObjectIdentifier(extConf.getType().getValue()));
    vec.add(new DEROctetString(extConf.getAccessRights().getValue()));
    ASN1Encodable extValue = new DERSequence(vec);
    authorizationTemplate = new ExtensionValue(extensionControls.get(type).isCritical(), extValue);
}
Also used : DERSequence(org.bouncycastle.asn1.DERSequence) ExtensionValue(org.xipki.ca.api.profile.ExtensionValue) ASN1EncodableVector(org.bouncycastle.asn1.ASN1EncodableVector) AuthorizationTemplate(org.xipki.ca.certprofile.x509.jaxb.AuthorizationTemplate) ASN1Encodable(org.bouncycastle.asn1.ASN1Encodable) ASN1ObjectIdentifier(org.bouncycastle.asn1.ASN1ObjectIdentifier) DEROctetString(org.bouncycastle.asn1.DEROctetString)

Example 17 with ExtensionValue

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

the class XmlX509Certprofile method initPolicyMappings.

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

Example 18 with ExtensionValue

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

the class XmlX509Certprofile method initValidityModel.

private void initValidityModel(Set<ASN1ObjectIdentifier> extnIds, ExtensionsType extensionsType) throws CertprofileException {
    ASN1ObjectIdentifier type = ObjectIdentifiers.id_extension_validityModel;
    if (!extensionControls.containsKey(type)) {
        return;
    }
    extnIds.remove(type);
    ValidityModel extConf = (ValidityModel) getExtensionValue(type, extensionsType, ValidityModel.class);
    if (extConf == null) {
        return;
    }
    ASN1ObjectIdentifier oid = new ASN1ObjectIdentifier(extConf.getModelId().getValue());
    ASN1Encodable extValue = new DERSequence(oid);
    validityModel = new ExtensionValue(extensionControls.get(type).isCritical(), extValue);
}
Also used : DERSequence(org.bouncycastle.asn1.DERSequence) ValidityModel(org.xipki.ca.certprofile.x509.jaxb.ValidityModel) ExtensionValue(org.xipki.ca.api.profile.ExtensionValue) ASN1Encodable(org.bouncycastle.asn1.ASN1Encodable) ASN1ObjectIdentifier(org.bouncycastle.asn1.ASN1ObjectIdentifier)

Example 19 with ExtensionValue

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

the class XmlX509Certprofile method initInhibitAnyPolicy.

private void initInhibitAnyPolicy(Set<ASN1ObjectIdentifier> extnIds, ExtensionsType extensionsType) throws CertprofileException {
    ASN1ObjectIdentifier type = Extension.inhibitAnyPolicy;
    if (!extensionControls.containsKey(type)) {
        return;
    }
    extnIds.remove(type);
    InhibitAnyPolicy extConf = (InhibitAnyPolicy) getExtensionValue(type, extensionsType, InhibitAnyPolicy.class);
    if (extConf == null) {
        return;
    }
    int skipCerts = extConf.getSkipCerts();
    if (skipCerts < 0) {
        throw new CertprofileException("negative inhibitAnyPolicy.skipCerts is not allowed: " + skipCerts);
    }
    ASN1Integer value = new ASN1Integer(BigInteger.valueOf(skipCerts));
    this.inhibitAnyPolicy = new ExtensionValue(extensionControls.get(type).isCritical(), value);
}
Also used : InhibitAnyPolicy(org.xipki.ca.certprofile.x509.jaxb.InhibitAnyPolicy) ExtensionValue(org.xipki.ca.api.profile.ExtensionValue) CertprofileException(org.xipki.ca.api.profile.CertprofileException) ASN1Integer(org.bouncycastle.asn1.ASN1Integer) 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