use of org.xipki.ca.certprofile.x509.jaxb.ExtensionValueType in project xipki by xipki.
the class ProfileConfCreatorDemo method createPrivateKeyUsagePeriod.
private static ExtensionValueType createPrivateKeyUsagePeriod(String validity) {
PrivateKeyUsagePeriod extValue = new PrivateKeyUsagePeriod();
extValue.setValidity(validity);
return createExtensionValueType(extValue);
}
use of org.xipki.ca.certprofile.x509.jaxb.ExtensionValueType in project xipki by xipki.
the class ProfileConfCreatorDemo method certprofileCross.
// method certprofileRootCa
private static X509ProfileType certprofileCross() throws Exception {
X509ProfileType profile = getBaseProfile("certprofile cross", X509CertLevel.SubCA, "10y", false);
// Subject
Subject subject = profile.getSubject();
subject.setIncSerialNumber(false);
List<RdnType> rdnControls = subject.getRdn();
rdnControls.add(createRdn(ObjectIdentifiers.DN_C, 1, 1, new String[] { "DE|FR" }, null, null));
rdnControls.add(createRdn(ObjectIdentifiers.DN_O, 1, 1));
rdnControls.add(createRdn(ObjectIdentifiers.DN_OU, 0, 1));
rdnControls.add(createRdn(ObjectIdentifiers.DN_SN, 0, 1, new String[] { REGEX_SN }, null, null));
rdnControls.add(createRdn(ObjectIdentifiers.DN_CN, 1, 1));
// Extensions
ExtensionsType extensions = profile.getExtensions();
List<ExtensionType> list = extensions.getExtension();
list.add(createExtension(Extension.subjectKeyIdentifier, true, false, null));
list.add(createExtension(Extension.cRLDistributionPoints, false, false, null));
list.add(createExtension(Extension.freshestCRL, false, false, null));
// Extensions - basicConstraints
ExtensionValueType extensionValue = null;
list.add(createExtension(Extension.basicConstraints, true, true, extensionValue));
// Extensions - AuthorityInfoAccess
extensionValue = createAuthorityInfoAccess();
list.add(createExtension(Extension.authorityInfoAccess, true, false, extensionValue));
// Extensions - AuthorityKeyIdentifier
extensionValue = createAuthorityKeyIdentifier(false);
list.add(createExtension(Extension.authorityKeyIdentifier, true, false, extensionValue));
// Extensions - keyUsage
extensionValue = createKeyUsages(new KeyUsageEnum[] { KeyUsageEnum.KEY_CERT_SIGN }, null);
list.add(createExtension(Extension.keyUsage, true, true, extensionValue));
return profile;
}
use of org.xipki.ca.certprofile.x509.jaxb.ExtensionValueType 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);
}
use of org.xipki.ca.certprofile.x509.jaxb.ExtensionValueType in project xipki by xipki.
the class ProfileConfCreatorDemo method certprofileRootCa.
// method marshal
private static X509ProfileType certprofileRootCa() throws Exception {
X509ProfileType profile = getBaseProfile("certprofile rootca", X509CertLevel.RootCA, "10y", false);
// Subject
Subject subject = profile.getSubject();
subject.setIncSerialNumber(false);
List<RdnType> rdnControls = subject.getRdn();
rdnControls.add(createRdn(ObjectIdentifiers.DN_C, 1, 1, new String[] { "DE|FR" }, null, null));
rdnControls.add(createRdn(ObjectIdentifiers.DN_O, 1, 1));
rdnControls.add(createRdn(ObjectIdentifiers.DN_OU, 0, 1));
rdnControls.add(createRdn(ObjectIdentifiers.DN_SN, 0, 1, new String[] { REGEX_SN }, null, null));
rdnControls.add(createRdn(ObjectIdentifiers.DN_CN, 1, 1));
// Extensions
ExtensionsType extensions = profile.getExtensions();
List<ExtensionType> list = extensions.getExtension();
list.add(createExtension(Extension.subjectKeyIdentifier, true, false, null));
list.add(createExtension(Extension.cRLDistributionPoints, false, false, null));
list.add(createExtension(Extension.freshestCRL, false, false, null));
// Extensions - basicConstraints
ExtensionValueType extensionValue = null;
list.add(createExtension(Extension.basicConstraints, true, true, extensionValue));
// Extensions - AuthorityInfoAccess
extensionValue = createAuthorityInfoAccess();
list.add(createExtension(Extension.authorityInfoAccess, true, false, extensionValue));
// Extensions - keyUsage
extensionValue = createKeyUsages(new KeyUsageEnum[] { KeyUsageEnum.KEY_CERT_SIGN }, new KeyUsageEnum[] { KeyUsageEnum.CRL_SIGN });
list.add(createExtension(Extension.keyUsage, true, true, extensionValue));
return profile;
}
use of org.xipki.ca.certprofile.x509.jaxb.ExtensionValueType in project xipki by xipki.
the class ProfileConfCreatorDemo method createAuthorizationTemplate.
// method createBiometricInfo
private static ExtensionValueType createAuthorizationTemplate() {
AuthorizationTemplate extValue = new AuthorizationTemplate();
extValue.setType(createOidType(new ASN1ObjectIdentifier("1.2.3.4.5"), "dummy type"));
ConstantValueType accessRights = new ConstantValueType();
accessRights.setDescription("dummy access rights");
accessRights.setValue(new byte[] { 1, 2, 3, 4 });
extValue.setAccessRights(accessRights);
return createExtensionValueType(extValue);
}
Aggregations