Search in sources :

Example 1 with IntWithDescType

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

the class ProfileConfCreatorDemo method createBiometricInfo.

// method createQcStatements
private static ExtensionValueType createBiometricInfo() {
    BiometricInfo extValue = new BiometricInfo();
    // type
    // predefined image (0)
    BiometricTypeType type = new BiometricTypeType();
    extValue.getType().add(type);
    IntWithDescType predefined = new IntWithDescType();
    predefined.setValue(0);
    predefined.setDescription("image");
    type.setPredefined(predefined);
    // predefined handwritten-signature(1)
    type = new BiometricTypeType();
    predefined = new IntWithDescType();
    predefined.setValue(1);
    predefined.setDescription("handwritten-signature");
    type.setPredefined(predefined);
    extValue.getType().add(type);
    // OID
    type = new BiometricTypeType();
    type.setOid(createOidType(new ASN1ObjectIdentifier("1.2.3.4.5.6"), "dummy biometric type"));
    extValue.getType().add(type);
    // hash algorithm
    HashAlgo[] hashAlgos = new HashAlgo[] { HashAlgo.SHA256, HashAlgo.SHA384 };
    for (HashAlgo hashAlgo : hashAlgos) {
        extValue.getHashAlgorithm().add(createOidType(hashAlgo.getOid(), hashAlgo.getName()));
    }
    extValue.setIncludeSourceDataUri(TripleState.REQUIRED);
    return createExtensionValueType(extValue);
}
Also used : BiometricInfo(org.xipki.ca.certprofile.x509.jaxb.BiometricInfo) BiometricTypeType(org.xipki.ca.certprofile.x509.jaxb.BiometricTypeType) HashAlgo(org.xipki.security.HashAlgo) IntWithDescType(org.xipki.ca.certprofile.x509.jaxb.IntWithDescType) ASN1ObjectIdentifier(org.bouncycastle.asn1.ASN1ObjectIdentifier)

Example 2 with IntWithDescType

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

Example 3 with IntWithDescType

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

the class ProfileConfCreatorDemo method createTlsFeature.

private static ExtensionValueType createTlsFeature(TlsExtensionType[] features) {
    List<TlsExtensionType> exts = Arrays.asList(features);
    Collections.sort(exts);
    TlsFeature tlsFeature = new TlsFeature();
    for (TlsExtensionType m : exts) {
        IntWithDescType ints = new IntWithDescType();
        ints.setValue(m.getCode());
        ints.setDescription(m.getName());
        tlsFeature.getFeature().add(ints);
    }
    return createExtensionValueType(tlsFeature);
}
Also used : TlsFeature(org.xipki.ca.certprofile.x509.jaxb.TlsFeature) TlsExtensionType(org.xipki.security.TlsExtensionType) IntWithDescType(org.xipki.ca.certprofile.x509.jaxb.IntWithDescType)

Aggregations

IntWithDescType (org.xipki.ca.certprofile.x509.jaxb.IntWithDescType)3 ASN1ObjectIdentifier (org.bouncycastle.asn1.ASN1ObjectIdentifier)2 TlsFeature (org.xipki.ca.certprofile.x509.jaxb.TlsFeature)2 BigInteger (java.math.BigInteger)1 ArrayList (java.util.ArrayList)1 ASN1Encodable (org.bouncycastle.asn1.ASN1Encodable)1 ASN1EncodableVector (org.bouncycastle.asn1.ASN1EncodableVector)1 ASN1Integer (org.bouncycastle.asn1.ASN1Integer)1 DERSequence (org.bouncycastle.asn1.DERSequence)1 CertprofileException (org.xipki.ca.api.profile.CertprofileException)1 ExtensionValue (org.xipki.ca.api.profile.ExtensionValue)1 BiometricInfo (org.xipki.ca.certprofile.x509.jaxb.BiometricInfo)1 BiometricTypeType (org.xipki.ca.certprofile.x509.jaxb.BiometricTypeType)1 HashAlgo (org.xipki.security.HashAlgo)1 TlsExtensionType (org.xipki.security.TlsExtensionType)1