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);
}
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);
}
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);
}
Aggregations