Search in sources :

Example 11 with ExtensionsType

use of org.xipki.ca.certprofile.x509.jaxb.ExtensionsType in project xipki by xipki.

the class XmlX509Certprofile method initKeyUsage.

private void initKeyUsage(Set<ASN1ObjectIdentifier> extnIds, ExtensionsType extensionsType) throws CertprofileException {
    ASN1ObjectIdentifier type = Extension.keyUsage;
    if (!extensionControls.containsKey(type)) {
        return;
    }
    extnIds.remove(type);
    KeyUsage extConf = (KeyUsage) getExtensionValue(type, extensionsType, KeyUsage.class);
    if (extConf == null) {
        return;
    }
    this.keyusages = XmlX509CertprofileUtil.buildKeyUsageOptions(extConf);
}
Also used : KeyUsage(org.xipki.ca.certprofile.x509.jaxb.KeyUsage) ExtendedKeyUsage(org.xipki.ca.certprofile.x509.jaxb.ExtendedKeyUsage) ASN1ObjectIdentifier(org.bouncycastle.asn1.ASN1ObjectIdentifier)

Example 12 with ExtensionsType

use of org.xipki.ca.certprofile.x509.jaxb.ExtensionsType 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 13 with ExtensionsType

use of org.xipki.ca.certprofile.x509.jaxb.ExtensionsType in project xipki by xipki.

the class XmlX509Certprofile method initPrivateKeyUsagePeriod.

private void initPrivateKeyUsagePeriod(Set<ASN1ObjectIdentifier> extnIds, ExtensionsType extensionsType) throws CertprofileException {
    ASN1ObjectIdentifier type = Extension.privateKeyUsagePeriod;
    if (!extensionControls.containsKey(type)) {
        return;
    }
    extnIds.remove(type);
    PrivateKeyUsagePeriod extConf = (PrivateKeyUsagePeriod) getExtensionValue(type, extensionsType, PrivateKeyUsagePeriod.class);
    if (extConf == null) {
        return;
    }
    privateKeyUsagePeriod = CertValidity.getInstance(extConf.getValidity());
}
Also used : ASN1ObjectIdentifier(org.bouncycastle.asn1.ASN1ObjectIdentifier) PrivateKeyUsagePeriod(org.xipki.ca.certprofile.x509.jaxb.PrivateKeyUsagePeriod)

Example 14 with ExtensionsType

use of org.xipki.ca.certprofile.x509.jaxb.ExtensionsType in project xipki by xipki.

the class XmlX509Certprofile method initSubjectToSubjectAltNames.

private void initSubjectToSubjectAltNames(ExtensionsType extensionsType) throws CertprofileException {
    SubjectToSubjectAltNamesType s2sType = extensionsType.getSubjectToSubjectAltNames();
    if (s2sType == null) {
        return;
    }
    subjectToSubjectAltNameModes = new HashMap<>();
    for (SubjectToSubjectAltNameType m : s2sType.getSubjectToSubjectAltName()) {
        Target target = m.getTarget();
        GeneralNameTag nameTag = null;
        if (target.getDirectoryName() != null) {
            nameTag = GeneralNameTag.directoryName;
        } else if (target.getDnsName() != null) {
            nameTag = GeneralNameTag.dNSName;
        } else if (target.getIpAddress() != null) {
            nameTag = GeneralNameTag.iPAddress;
        } else if (target.getRfc822Name() != null) {
            nameTag = GeneralNameTag.rfc822Name;
        } else if (target.getUniformResourceIdentifier() != null) {
            nameTag = GeneralNameTag.uniformResourceIdentifier;
        } else if (target.getRegisteredID() != null) {
            nameTag = GeneralNameTag.registeredID;
        } else {
            throw new RuntimeException("should not reach here, unknown SubjectToSubjectAltName target");
        }
        subjectToSubjectAltNameModes.put(new ASN1ObjectIdentifier(m.getSource().getValue()), nameTag);
    }
}
Also used : Target(org.xipki.ca.certprofile.x509.jaxb.SubjectToSubjectAltNameType.Target) SubjectToSubjectAltNameType(org.xipki.ca.certprofile.x509.jaxb.SubjectToSubjectAltNameType) GeneralNameTag(org.xipki.ca.api.profile.GeneralNameTag) SubjectToSubjectAltNamesType(org.xipki.ca.certprofile.x509.jaxb.SubjectToSubjectAltNamesType) ASN1ObjectIdentifier(org.bouncycastle.asn1.ASN1ObjectIdentifier)

Example 15 with ExtensionsType

use of org.xipki.ca.certprofile.x509.jaxb.ExtensionsType 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)

Aggregations

ASN1ObjectIdentifier (org.bouncycastle.asn1.ASN1ObjectIdentifier)39 ExtensionType (org.xipki.ca.certprofile.x509.jaxb.ExtensionType)20 ExtensionsType (org.xipki.ca.certprofile.x509.jaxb.ExtensionsType)18 Subject (org.xipki.ca.certprofile.x509.jaxb.X509ProfileType.Subject)18 RdnType (org.xipki.ca.certprofile.x509.jaxb.RdnType)17 X509ProfileType (org.xipki.ca.certprofile.x509.jaxb.X509ProfileType)17 ExtensionValueType (org.xipki.ca.certprofile.x509.jaxb.ExtensionValueType)16 KeyUsageEnum (org.xipki.ca.certprofile.x509.jaxb.KeyUsageEnum)16 TlsExtensionType (org.xipki.security.TlsExtensionType)16 ExtensionValue (org.xipki.ca.api.profile.ExtensionValue)13 CertprofileException (org.xipki.ca.api.profile.CertprofileException)9 ASN1Encodable (org.bouncycastle.asn1.ASN1Encodable)8 IOException (java.io.IOException)5 HashMap (java.util.HashMap)5 DERSequence (org.bouncycastle.asn1.DERSequence)5 SubjectAltName (org.xipki.ca.certprofile.x509.jaxb.SubjectAltName)5 ASN1EncodableVector (org.bouncycastle.asn1.ASN1EncodableVector)4 ASN1Integer (org.bouncycastle.asn1.ASN1Integer)4 ASN1StreamParser (org.bouncycastle.asn1.ASN1StreamParser)4 AuthorityInfoAccess (org.xipki.ca.certprofile.x509.jaxb.AuthorityInfoAccess)4